David Mathog
6/3/2011 7:13:00 PM
On Jun 3, 6:45 am, ImpalerCore <jadil...@gmail.com> wrote:
> The same issue occurs with the Microsoft C Runtime and C99 printf
> support. You can compile 'printf( "%lu %zu\n", sizeof (int), sizeof
> (int) );' with gcc -std=c99 in the MinGW environment, but because it
> links in the Microsoft Runtime, the printf statement just generates "4
> zu". Similar problems occur for modifiers 't' and 'll'.
Which raises the question - why do we do that? Is there some reason
why the compilers never seem to supply the equivalent of libc? Sure,
there are going to be instances where one can get away with using the
native OS libc, but clearly there are lots of other cases where it
doesn't work out so well. And I would wager it works out less and
less well as the target OS ages.
Here is another test which failed indicating a Solaris vs. Linux
difference:
36 Fail 0000000.053 22c22
< NaN,Inf,Inf,-Inf,NaN
---
> nan,inf,inf,-inf,nan
Do any of the C standards say what fprintf("%lf\n",dval) is supposed
to emit in each of these cases? Is it really free to use alternate
capitalization? I can see the upside in ignoring the punctuation when
reading in these values, but not so much in emitting them.
Regards,
David