Re: Strange read(2) behavior on powerpc.

2010-04-06 Thread Ludwig Mises
On Tue, Apr 6, 2010 at 9:41 PM, Ted Unangst wrote: >> s = (char *) malloc(st.st_size); > > If you didn't have bogus casts in your code, the compiler could tell > you what's wrong with it. You're right, and in fact, I put the cast there to hide that particular compiler warning without realizing t

Re: Strange read(2) behavior on powerpc.

2010-04-06 Thread Ludwig Mises
On Tue, Apr 6, 2010 at 7:22 PM, Philip Guenther wrote: > > $ 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' Y

Re: Strange read(2) behavior on powerpc.

2010-04-06 Thread Ted Unangst
On Tue, Apr 6, 2010 at 9:05 PM, Ludwig Mises wrote: > The following code exits cleanly (exit status 0) on i386, but on macppc exits 4: > s = (char *) malloc(st.st_size); If you didn't have bogus casts in your code, the compiler could tell you what's wrong with it.

Re: Strange read(2) behavior on powerpc.

2010-04-06 Thread Philip Guenther
On Tue, Apr 6, 2010 at 6:05 PM, Ludwig Mises 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: implici