>>>> "Gary" == Gary Sparkes,
<Gary> writes:
Gary> That's REALLY weird, endian issue or is that just undefined
Gary> behavior in the C spec?
>> On May 13, 2005, at 2:24 PM, Paul
>> Koning wrote:
> GCC produces 2 1 0 on x86 and 0 1 2 on MIPS.
Undefined behavior, so both are correct.
I suspect the underlying cause is that x86 passes all args on the
stack, while MIPS passes the first four (or eight) in registers. So
the x86 code looks like this:
push 0
push 1
push 2
push (pointer to "%d %d %d")
call printf
while the MIPS code looks like
la a0, (pointer to "%d %d %d")
li a1, 0
li a2, 1
li a3, 2
jal printf
paul