From: Maarten B. <sou...@ds...> - 2011-09-23 19:04:34
|
> Am 23.09.2011 19:03, schrieb Raphael Neider: > > > > > We had discussed this problem when it was implemented and did not > > find *the* ideal solution back then. Not sure if we can find one now > > :-( > > Where can I find this discussion? Not doing the argument promotions > (i.e. float to double, small thing like unsigned char to int, big things > to long) required by the standard looks like a bug to me. I'm not sure where the discussion was held, though probably on the developer mailing list. Of course there is no "ideal" solution. But if you don't want this behaviour then do not use the SDCC extensions and use --std-c99 or --std-c89 instead. The extension is useful for "small devices" which are the exact target of SDCC. SDCC != GCC. > what difference does the cast make? the declaration is already uint8, > so isn't the cast a no-op? what am i missing? No, it tells SDCC *NOT* to cast the uint8 to int as it otherwise would. > this sdcc behavior bites us (bytes us? :-) all the time -- i'm always > having to go back to add "(uint)foo" casts when printing byte-wide > values as %x or %d, to make the values show correctly. unless there > are new format chars for byte-wide parameters, how does this save > memory? There certainly are new format chars to specify byte- wide parameters. If I remember correctly they originated in the PIC backends but printf_large.c (the printf engine) supports at least the 'b' modifier. You should not have to 'go back to add "(uint)foo" casts' as the default without a cast is to pass every char as an int. Just don't add an explicit (char) cast. Maarten |