You might also find it interesting that m4ster r0shi's code could unexepected crash on any given given due to the static initialization order fiasco. (I realize he did this for illustration purposes, but this is an important point nontheless)
Basically if you have some code running before main starts, you must be sure that any variable used in that code has been construted.
There's no way to know whether or not 'cout' has been constructed by the time his before_main function is run. If cout hasn't been constructed, that code will have bizzare sideeffects and/or will crash and burn.
Likewise, you have the same problem when things are destructed. There's no way to guarantee that after_main is run before cout is destructed. If cout is destructed first, you have another potential program explosion.
EDIT: basically what kbw said.
This is pretty much something you should never do. If you want to run code before main starts, don't use any global objects, or call any code that might use global objects.
I always have to laugh a little at these kinds of discussions.
The main() function is precicely defined as the entry point to a program. Hence, if you want something special to happen at the very beginning of your program, it should be at the very beginning of the main function block.
fprintf(stdout, "stuff");
Now i'm someone who does not know C well, and can only read it through my knowledge of C++, but how unnecessary does that look!