Stack alignment vs. struct alignment
- From: "Kevin Dean" <Dolphin@xxxxxxxxxxxxxxxxx>
- Date: Tue, 04 Apr 2006 05:50:13 -0700
I'm compiling for Win32 and am using the default struct alignment, which I believe is 8 bytes. I have the following structure:
struct TData
{
double value;
bool isNull;
};
I'm expecting that to be aligned to 8 bytes, and sure enough the __alignof() operator returns 8 for this structure. However, when this object gets created on the stack, it's not 8-byte aligned (the address has a remainder of 4). How do I force objects on the stack to obey the compiler alignment setting? The alignment is a critical part of some legacy code that I'm trying to migrate and I can't use byte alignment. Any help would be appreciated.
--
.
- Follow-Ups:
- Re: Stack alignment vs. struct alignment
- From: Alex Blekhman
- Re: Stack alignment vs. struct alignment
- From: Christian Ehlscheid
- Re: Stack alignment vs. struct alignment
- Prev by Date: Re: Alternative to exit( )
- Next by Date: Re: Behaviour of an automatic static variable?
- Previous by thread: RE: find a charcter
- Next by thread: Re: Stack alignment vs. struct alignment
- Index(es):
Relevant Pages
|