Harti Brandt <[EMAIL PROTECTED]> wrote: > > > Hmm, I though the following would work: > > void > foo(unsigned short *s) > { > unsigned short temp; > > temp = s[0]; > s[0] = s[1]; > s[1] = temp; > } > > main() > { > int i = 0x12345678; > > foo(&i); > printf("%08x\n", i); > } > > because how would the compiler in main() know, that you do something wrong > in foo(). But... if you compile this with -O5, it does not work! This is > because the compiler inlines foo() into main and the program prints junk like > 0x12342804.
Nope - that doesn't work either. The call to foo() is not compatible with the prototype (in fact, the Systems/C compiler issues a warning on this: Warning #2034: passing argument 1 from incompatible pointer type I believe gcc would as well. - Dave Rivers - -- [EMAIL PROTECTED] Work: (919) 676-0847 Get your mainframe programming tools at http://www.dignus.com To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message