On Tue, Apr 6, 2010 at 6:05 PM, Ludwig Mises <ludwigmi...@gmail.com> wrote:
> The following code exits cleanly (exit status 0) on i386, but on macppc exits 
> 4:
...
> $ gcc -o blah blah.c
...
> Is there something wrong with the .c program?

Yes.

$ gcc -Wall blah.c
blah.c: In function `main':
blah.c:16: warning: implicit declaration of function `exit'
blah.c:19: warning: implicit declaration of function `malloc'
blah.c:28: warning: implicit declaration of function `free'
$

One of those lines has undefined behavior that typically manifests
itself as _appearing_ to operate correctly on little-endian platforms
but doing the Wrong Thing on big-endian platforms.


Philip Guenther

Reply via email to