[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] gcc -mshort question



Oddie  Jonathan <oddie@bvsd.k12.co.us> writes:

|> >Hi Jonathan!
|> >
|> >OJ>Just yesterday I noticed that my gcc seems to be doing strange things
|> >OJ>when -mshort is enabled. It reports sizeof(short)=0, long=2, int=0,
|> >OJ>and char=4. Without -mshort shorts are 2, longs and ints 4, and chars
|> >OJ>1, just as it should be.
|> >Do not use %d, %u or %x  in the format string for printf(), use %ld, %lu or
|> >%lx instead (the values returned by sizeof are 4 Bytes long)
|> 
|> OK -- I never knew about those conversions, as I've just been using
|> the back of the K&R book for library reference.
|> 
|> I still think it might be a good idea to get a new compiler though :)

Compile with -Wformat and gcc will tell you about the format mismatch.

Andreas.

-- 
Andreas Schwab                                      "And now for something
schwab@issan.cs.uni-dortmund.de                      completely different"
schwab@gnu.org