www.digitalmars.com         C & C++   DMDScript  

c++.dos.32-bits - Re: Alignment

reply "Nic Tiger" <nictiger pt.comcor.ru> writes:
Hi, Walter!

Do I understand alignment settings right?
If I specify -a8, then:
    BYTE (char)         will not be aligned (it is useless)
    WORD(short int)   will be aligned on 2-byte boundary
    DWORD(long int) will be aligned on 4-byte boundary
    QWORD(double)  will be aligned on 8-byte boundary

Is that right? (double) alignment is the only difference between -a4 and -a8
, isn't it?

And what happens with alignment when parameters are placed onto stack for
function call?

And, by the way, is the stack initially aligned on 16-byte boundary? Intel
recommends doing so for optimal performance.

Looking forward for your answer,
        Nic Tiger.
Mar 11 2002
parent "Walter" <walter digitalmars.com> writes:
"Nic Tiger" <nictiger pt.comcor.ru> wrote in message
news:a6hssi$13jc$1 digitaldaemon.com...
 Do I understand alignment settings right?
 If I specify -a8, then:
     BYTE (char)         will not be aligned (it is useless)
     WORD(short int)   will be aligned on 2-byte boundary
     DWORD(long int) will be aligned on 4-byte boundary
     QWORD(double)  will be aligned on 8-byte boundary

 Is that right? (double) alignment is the only difference between -a4
and -a8
 , isn't it?
Yes, yes.
 And what happens with alignment when parameters are placed onto stack for
 function call?
They are 4 byte aligned in 8.26 and earlier, 8 byte aligned for 8.27 (the beta version is available for download).
 And, by the way, is the stack initially aligned on 16-byte boundary? Intel
 recommends doing so for optimal performance.
Not at the moment. I should probably fix that.
Mar 11 2002