Yeah, that one is responsible for this fun piece of code
Oh. Oh... I'm adding [font=courier new,courier,monospace]volatile[/font] to my list of keywords that should almost never, ever be used -- I think it only appears once in my entire game engine, inside a class that is just a reinvention of a C++11 standard class, meaning it doesn't need to exist.
I'd go as far as to say that if you're using the [font=courier new,courier,monospace]volatile[/font] keyword, you've probably got a bug.
[quote name='Olof Hedman' timestamp='1354783859' post='5007683']
Interesting.
The clear separation of a declaration and an implementation is one of the things I really like with C and C++.
The header file has (should have) everything I need as a _user_ of the class, and nothing more.
Makes the intention of the class very clear, and then I can "hide" the implementation in a cpp file.
Except that the header file also contains information about private member variables and methods. So you either give the client all the details about the class, or you end up using something like pimpl, which is yet another hoop to jump through that other languages have realised provides no tangible benefit.[/quote]I'm also in the camp that gets extremely bothered by the fact that in C#/Java/etc there's no separation between declaration and implementation. I really love the fact that [font=courier new,courier,monospace].h[/font] files can just show you the what without the how.
I often use PIMPL-style idioms, where I'm writing the same thing 3 times, instead of twice, but still prefer it over C# style classes... It's not like writing lines of code is actually anyone's bottleneck or main time-sink when programming anyway.
One of the styles that I like is having [font=courier new,courier,monospace]foo.h[/font] with just the stuff the user needs to see, then [font=courier new,courier,monospace]foo_impl.h[/font] with the member variables/data layout, then [font=courier new,courier,monospace]foo.cpp[/font] with the method implementations. If you're using a [font=courier new,courier,monospace]foo[/font] you just need the first, if you're creating a [font=courier new,courier,monospace]foo[/font] you need the 2nd, or if you're working on [font=courier new,courier,monospace]foo[/font] you need the 3rd.
This isn't the 80's anymore. We don't have to program in vi and cc on the command line. Realistically, managing any project of a decent size without an IDE is just making work for no reason.[/quote]On the same point, C++ IDEs have features to automatically duplicate/sync the necessary lines between [font=courier new,courier,monospace].h[/font] and [font=courier new,courier,monospace].cpp[/font] files, if you care for that kind of thing.