[SDL] sdl program compiled with "-O2 -g0" takes ages to start
Mason Wheeler
masonwheeler at yahoo.com
Mon Jun 29 12:09:19 PDT 2009
>----- Original Message ----
>From: Bob Pendleton <bob at pendleton.com>
>Subject: Re: [SDL] sdl program compiled with "-O2 -g0" takes ages to start
>
>On Mon, Jun 29, 2009 at 1:13 PM, Mason Wheeler<masonwheeler at yahoo.com> wrote:
>>
>>>From: Bob Pendleton <bob at pendleton.com>
>>>Subject: Re: [SDL] sdl program compiled with "-O2 -g0" takes ages to start
>>>On Mon, Jun 29, 2009 at 12:07 AM, Vassilis
>>>Virvilis<vasvir at iit.demokritos.gr> wrote:
>>>>
>>>> Looks like the infamous "static initialization order fiasco"
>>>>
>>>> http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.12
>>>
>>>Exactly. Static initialization in C++ is a very powerful tool, rather
>>>like a hand grenade. Used mindfully, by a trained practitioner, it is
>>>an extremely effective way of solving problems. Used by an amateur it
>>>gives you a dead amateur and maybe some dead and injured bystanders
>>>too. May be not the best example I ever came up with... :-)
>>
>> "Powerful" isn't the word I'd use to describe a feature that leaves one of
>> its most important pieces of functionality undefined, and makes it all too
>> easy to write code that depends on this undefined functionality. I believe
>> "defective" would be a more accurate term.
>
>I guess that puts you in the "hand grenade is an appropriate example camp"? ;-}
>
>Bob Pendleton
*grin* I suppose. I have to wonder how something like that ended up in the
language in the first place. Is it just yet another strange side-effect of C++'s
C roots being grafted onto a completely inappropriate tree, or is this a
completely new feature that has no C analogue?
This is one of the places where I can't even really say "and Delphi does it
better" even though it does, because it's an apples-to-oranges comparison.
The way Delphi handles initialization to give a well-defined order of
execution probably wouldn't work on a language that doesn't compile in a
single pass.
More information about the SDL
mailing list