Comparing D structs
grauzone
none at example.net
Sun May 17 14:22:29 PDT 2009
Dan wrote:
> That sounds great, and seems like yet another reason for me to switch to D (other than the removal of header files which always seemed like a kludge).
I heard that the compiler can change the padding bytes to non-null on
some occasions. For example, the compiler could treat member a as 32 bit
value when assigning it:
struct {
char a; //offset 0
int b; //offset 4
}
Nothing in the C standard says that the compiler has to preserve the
padding bytes between a and b. So I was told.
> Just for the record though, I think one can initialize/blank/calloc C structs too, but the problem is that some struct elements (of the same array) may have padding while others don't, or perhaps they have different size paddings.
Not sure what you mean.
More information about the Digitalmars-d-learn
mailing list