tags:

views:

21

answers:

2

I have built a test for a driver in Windows CE 6.0 and some tests fail because memory passed in is not properly aligned.

How can I control the alignment of auto variables on the stack (not inside structures)?

Keep in mind that I cannot change this test in any way except how I build it.

A: 

There is no error message, the problem is when an unsigned byte is declared on the stack, the address is not 4-byte aligned, and I need it to be.

The exe that is built is a conformance test and I cannot change the code. When I build for windows the stack vars are 4-byte aligned, but when I build for CE they are not aligned

wincehelp
Edit your original question with info like this or use a COmment in the answer you're clarifying for. Only provide an Answer if you are answering your actual question.
ctacke
I lost the handle to the account I asked this question from
wincehelp
A: 

Automatic variables are automatically aligned according to their natural alignment, unless you explicitly tell the compiler not to do so. So, if you need an address with 4 byte alignment, declare a 4 byte variable, like a DWORD.

karunski