Are padding bits always zero?

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 24 07:03:16 PDT 2017


On Saturday, 24 June 2017 at 12:41:47 UTC, Steven Schveighoffer 
wrote:
> There is no spec for this, but I know that when the compiler 
> has to fill gaps with something it chooses 0.

I'm almost certain there at least used to be a spec for this, 
because I remember citing a link to someone who then complained 
that this zero requirement hurt optimization of void members. On 
the other hand though, the zero padding requirement does simplify 
equality to being memcmp.

I can't find the reference now. Perhaps I'm looking in the wrong 
place... or perhaps that optimization complaint actually got the 
requirement removed from the spec.

I don't know. (I find search of most D stuff to be fruitless and 
heavily rely on my old brain memory to index these things, but 
while my memory is pretty good, it isn't flawless.)


More information about the Digitalmars-d-learn mailing list