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

Steven Schveighoffer via Digitalmars-d-announce digitalmars-d-announce at puremagic.com
Thu May 29 06:11:52 PDT 2014


On Wed, 28 May 2014 22:38:55 -0400, Jesse Phillips  
<Jesse.K.Phillips+D at gmail.com> wrote:

> 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)?

IIRC, the entire section of global TLS data is initialized, and is all  
contiguous memory, so it would be anti-performant to initialize all but 4  
bytes.

Note:

struct X
{
   int a;
   int b = void; // also initialized to 0.
}

This is because X must blit an init for a, and it would be silly to go  
through the trouble of blitting X.init to a, but not b. Especially, for  
instance, if you had an array of X (you'd have to blit every other int!)

-Steve


More information about the Digitalmars-d-announce mailing list