Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 170 171 [172] 173 174 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 888138 times)

kaijyuu

  • Bay Watcher
  • Hrm...
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2565 on: June 19, 2012, 07:53:18 pm »

@Magma

It works and it's beautiful  :'(
Logged
Quote from: Chesterton
For, in order that men should resist injustice, something more is necessary than that they should think injustice unpleasant. They must think injustice absurd; above all, they must think it startling. They must retain the violence of a virgin astonishment. When the pessimist looks at any infamy, it is to him, after all, only a repetition of the infamy of existence. But the optimist sees injustice as something discordant and unexpected, and it stings him into action.

MagmaMcFry

  • Bay Watcher
  • [EXISTS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2566 on: June 19, 2012, 08:34:15 pm »

I used to use preprocessor macros, but this is much safer.
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2567 on: June 19, 2012, 08:40:35 pm »

C++'s lambda expressions are sexy and they know it.

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2568 on: June 19, 2012, 09:11:58 pm »

I knew lambdas or closures would be the way to do it! :P
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2569 on: June 20, 2012, 02:38:20 am »

Code: [Select]
    auto IncrementCounters = [&]()
That is sexy. Damn, I knew I shouldn't have just glossed over those c++11 changes.
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #2570 on: June 20, 2012, 10:41:23 am »

*sigh* Damn getting something to compile in visual studio is a bitch. After implementing some previously variadic classes and functions with a tonne of overloads and template specialisations (yaaay, let's see how quickly *that* breaks) I'm having to do some more tricks to get around that Visual Studio doesn't support default/deleting constructors, which are very useful when combined with the new looser POD requirements. Plus all the defines of JML_CONSTEXPR to get around visual studio not supporting constexpr yet.

And then there's the way it doesn't even support C99 features like variables in initializer lists for POD types...argh.

In other news: Just read a review of the Doom 3 source: http://fabiensanglard.net/doom3/index.php Is awesome, yah? :P

**********

Okay, mega fuck Visual Studio. Why the *devil* does having a virtual destructor implemented in a cpp for exactly *one* of my classes give me a linker error, and a virtual destructor implemented inline in a hpp file work perfectly? What weird arse behaviour is this?
« Last Edit: June 20, 2012, 01:22:57 pm by MorleyDev »
Logged

Araph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2571 on: June 20, 2012, 02:20:42 pm »

Has anybody here used libtcod with C++? And if so, do you know of any tutorials for it? I've trawled Google for quite some time, but I can only find one tutorial for Python. Another person was working on converting the Python tutorial to C++, but that was a year ago and the only link in the thread to the converted code is broken.
Logged

Siquo

  • Bay Watcher
  • Procedurally generated
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2572 on: June 20, 2012, 04:41:15 pm »

The wiki/documentation had extensive C++ examples, last time I used it...
Logged

This one thread is mine. MIIIIINE!!! And it will remain a happy, friendly, encouraging place, whether you lot like it or not. 
will rena,eme sique to sique sxds-- siquo if sucessufil
(cant spel siqou a. every speling looks wroing (hate this))

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2573 on: June 20, 2012, 05:58:26 pm »

MorleyDev: cygwin + gcc. Or CodeBlocks + MinGW. Take your pick.

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #2574 on: June 20, 2012, 06:06:06 pm »

MorleyDev: cygwin + gcc. Or CodeBlocks + MinGW. Take your pick.

I'm using the nuwen build of gcc 4.7 with Eclipse mostly (Eclipse has some fairly good template autocomplete support) ^^ I was mostly just getting it to work in Visual Studio to see if I could.

Conclusion: The Visual C++ is a terrible compiler when working in just native C++. Random features from both the old and new the standards are missing, with which features are not present seemingly being completely arbitrary. Initialiser lists for constructing POD types? Explicit Operators? Constexpr? Who needs those, have some Metro!

Not to mention some of the limitations placed upon using C++/CLI for getting code to work with .NET are ridiculously needless. Why can't I include thread, mutex or conditional_variable? You support them in the native C++ compiler. Why does C++/CLI not allow them? Of course boost::thread will work fine, why wouldn't it? Why don't thread, mutex and conditional variables from the STL? What madness did conceive thee vile hellspawn of a compiler!?!?!
« Last Edit: June 20, 2012, 06:48:08 pm by MorleyDev »
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2575 on: June 20, 2012, 09:30:49 pm »

MorleyDev: cygwin + gcc. Or CodeBlocks + MinGW. Take your pick.

I'm using the nuwen build of gcc 4.7 with Eclipse mostly (Eclipse has some fairly good template autocomplete support) ^^ I was mostly just getting it to work in Visual Studio to see if I could.

Conclusion: The Visual C++ is a terrible compiler when working in just native C++. Random features from both the old and new the standards are missing, with which features are not present seemingly being completely arbitrary. Initialiser lists for constructing POD types? Explicit Operators? Constexpr? Who needs those, have some Metro!

Not to mention some of the limitations placed upon using C++/CLI for getting code to work with .NET are ridiculously needless. Why can't I include thread, mutex or conditional_variable? You support them in the native C++ compiler. Why does C++/CLI not allow them? Of course boost::thread will work fine, why wouldn't it? Why don't thread, mutex and conditional variables from the STL? What madness did conceive thee vile hellspawn of a compiler!?!?!

The really sad thing is, Microsoft is on the C++ Standards Committee.

MadocComadrin

  • Bay Watcher
  • A mysterious laboratory goblin!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2576 on: June 21, 2012, 04:03:01 am »

Not only that, but Visual C++ allows for so much stuff that isn't allowed by standards. I once did really poor on a programming project because I had to spend most of my time trying to get the prof's work to compile before I could even complete the parts that needed completing.
Logged

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #2577 on: June 21, 2012, 01:17:41 pm »

The really sad thing is, Microsoft is on the C++ Standards Committee.

That's that's...what? What the...howa...das....asdkljalk...MorleyDev is not in right now, please leave a message after the beep. Quack.

MorleyDev cancels Browse Internets, too insane.
Logged

dreadmullet

  • Bay Watcher
  • Inadequate Comedian
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2578 on: June 23, 2012, 10:29:25 pm »

I've a question about C++ and dynamic memory: I've been thinking that whenever there is a "new" somewhere in the code, there should always, always be a "delete" or "delete[]" somewhere else. Is this a reasonable guideline?
Logged

Mego

  • Bay Watcher
  • [PREFSTRING:MADNESS]
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2579 on: June 23, 2012, 11:42:22 pm »

I've a question about C++ and dynamic memory: I've been thinking that whenever there is a "new" somewhere in the code, there should always, always be a "delete" or "delete[]" somewhere else. Is this a reasonable guideline?

Short answer: Yes.

Spoiler: Longer answer (click to show/hide)
Pages: 1 ... 170 171 [172] 173 174 ... 796