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

Re: [XaraXtreme-dev] Doubles and Strings



Martin Wuerthner wrote:
When using sprintf et al., "%f" means double and "%lf" is undefined. The reason is some arcane bit of C semantics that causes the supplied value argument to be promoted to double anyway, so it does not make any difference whether you pass a float or a double. For obvious reasons, argument promotion does not apply to pointers, so the scanf family of routines has to distinguish between float and double. A good compiler checks the format string and the supplied pointer types and issues a warning if they do not match. I was under the impression that GCC does that.

camScanf works through varags, it's actually vswscanf that gets called,
with an argptr, so no opportunity for compile-time checks. That's
because wxFormatConverter gets in the way to convert (say)
%s to %ls, so the format string is the same on Unicode and non-Unicode.

Are you *SURE* %lf is undefined for output versions? That's really
very annoying especially as I've just converted them all over. I
thought superfluous size qualifiers were meant to be discarded...

Alex