RE: Structs pushed on stack backwards?
RE: Structs pushed on stack backwards?
- Subject: RE: Structs pushed on stack backwards?
- From: Jeff Laing <email@hidden>
- Date: Mon, 30 Apr 2007 09:39:16 +1000
> <http://developer.apple.com/documentation/DeveloperTools/Conceptual/
> LowLevelABI/Articles/IA32.html>
>
> has a diagram in "Passing Structures and Vectors" that shows that
> small structs get passed on the stack backwards. I.e., I have a
> structure
>
> struct PseudoPoint { float x; float y; };
>
> and it gets passed as a parameter on the stack as:
>
> y
> x
>
> Wouldn't it be easier to leave everything in its proper order?
Um, it is in its proper order. The stack grows backwards, remember.
If you take the address of the x on the stack, its pointing to x followed by
y in ascending memory address order...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden