View Single Post
Old 11-09-2012, 03:34 AM   PM User | #2
oracleguy
Rockstar Coder


 
Join Date: Jun 2002
Location: USA
Posts: 9,042
Thanks: 1
Thanked 322 Times in 318 Posts
oracleguy is a jewel in the roughoracleguy is a jewel in the roughoracleguy is a jewel in the rough
That program isn't actually returning a value though. Or did you omit some of the code?

That gcc flag is telling the compiler to keep the stack word aligned if you set it to 2. In 64-bit when the flag is set to 4, the stack is double word aligned. (see: http://gcc.gnu.org/onlinedocs/gcc-4....4-Options.html)

While the code you posted is confusing since it seems like some of it is missing, changing the +2 to a +4 might fix the problem.

However also keep in mind that when compiling for 64-bit the compiler is going to do some very different things because by default it can utilize a lot more advanced features of the processor.

In normal development it would be extremely rare that you would want to set the stack alignment boundary, for things like that it is best to let the compiler decide. Also keep in mind that as the GCC manual says, just because you tell it 2 or 4 doesn't mean it actually will. The compiler will ultimately decide what to do.
__________________
OracleGuy
oracleguy is offline   Reply With Quote