Page 1 of 1

What is the D equivalent to the C __attribute__((packed))

Posted: Thu Jul 09, 2009 9:01 pm
by brentS
How would you tell the D compiler you want a struct '__attribute__((packed))' ?

Re: What is the D equivalent to the C __attribute__((packed))

Posted: Thu Jul 09, 2009 9:31 pm
by Zenith
Glad to see someone else is interested in D, though I'd advise someone to get really comfortable with the language before starting OSDev with it. :wink:

Anyway, alignment is done using the align() attribute. For an entire struct to have packed alignment, you'd do align(1) struct {...}. More info can be found at the D specification site, specifically here.

Hope this helps!

Re: What is the D equivalent to the C __attribute__((packed))

Posted: Thu Jul 09, 2009 9:34 pm
by Solar
Zenith wrote:I'd advise someone to get really comfortable with the language before starting OSDev with it. :wink:
Very true, regardless of the language.

Re: What is the D equivalent to the C __attribute__((packed))

Posted: Fri Jul 10, 2009 9:40 am
by brentS
Thanks. And yeh I know lol I should have played around with D a little more before jumping into a kernel but...temptation gets you hha.