Nobody Understands C++: Part 2: RAII

Understanding RAII is critical to understanding good C++ design.



Linux Thread Memory Usage

During the course of debugging a potential memory leak at work I noticed that Linux seems to allocate at least 8M of memory for each thread created. This very simple test program illustrates the memory allocations:



Crate Game Engine snapshot-20080313 Release

This is the first release of the Crate Game Engine after the rewrite.



Multithreaded C++: Part 1: Pthreads

Note that some of the details on volatile are out of date now - 2016-03-15



C++ Question of the Day: Volatile Keyword

Jon asks:



C++ Templates: Using Templates to Generate the Fibonacci Sequence

The follow code demonstrates a method for generating the Fibonacci Sequence at compile time. Since the sequence is generated at compile time runtime execution of retrieving a number is constant time.



Site Updates

I just updated the site with a new version of Drupal and am still working out some problems. Currently the image module doesn’t work correctly, so images will be missing. I’ll be tracking the updates to the modules and will get things back up as I can. In the meantime all the content is available.



Nobody Understands C++: Intro

This is going to be the first post of several, though I’m not sure how many just yet. The title of the post should be self explanatory, but I will elaborate. It is my strongly held belief that C++ is generally poorly understood and gets a bad rap because of this. It is also my belief that this is NOT the fault of C++, but rather the fault of old-school C++ developers who learned the language before the language was ratified in 1998.



Boost Preprocessor Metaprogramming and Intro to Templates Revisited

Say you come up with a clever idea for initializing standard container types (blatantly stolen from the C++0x Initializer List concept). It might looks something like the implementation below:



Boost::Spirit: A BNF Parser Generator

The boost spirit library allows for direct translation of a BNF grammar into C++ code which generates a parser at compile time. The following example, from http://spirit.sourceforge.net/distrib/spirit_1_8_3/libs/spirit/doc/introduction.html truly does this concept more justice than I could: BNF Example: