Scott Meyers' DConf 2014 keynote "The Last Thing D Needs"

Leandro Lucarella via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu May 29 03:38:27 PDT 2014


Jesse Phillips, el 29 de May a las 02:38 me escribiste:
> On Wednesday, 28 May 2014 at 04:48:11 UTC, Jesse Phillips wrote:
> >I did a translation of most of the code in the slides.
> >
> >http://dpaste.dzfl.pl/72b5cfcb72e4
> >
> >I'm planning to transform it into blog post (or series). Right now
> >it just has some scratch notes. Feel free to let me know
> >everything I got wrong.
> 
> Hoping someone can confirm or deny this thought.
> 
>     int x2prime = void; // (at global scope)
> 
> Since x2prime is module variable, I would expect that the compiler
> will always initialize this to 0 since there isn't really a
> performance hit. Or is using void guarantee it won't get initialized
> (so much value in that guarantee)?

global/static variables are placed in a special section in the
executable. You need to put some value on it, so it is sensible to put
the same value you use for initialization, but a compiler implementation
could use a different value. I think void means "you don't know what the
value is", not "is a random value" or "a value different from the
default" (which is impossible for stack values, at least if the idea
behind void is to avoid the extra runtime cost ;).

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
You should've seen her face. It was the exact same look my father gave
me when I told him I wanted to be a ventriloquist.
	-- George Constanza


More information about the Digitalmars-d-announce mailing list