Re: data type for decimal number
On Feb 18, 12:32 pm, rober...@ibd.nr c-cnrc.gc.ca (Walter Roberson)
wrote:
So this means that the ISO standard was actually different from
the ANSI one (because the ISO one has two paragraphs, one for 'i,d',
and another one for 'o,u,x,X')? Is there a list of changes somewhere?
Yevgen
On Feb 18, 12:32 pm, rober...@ibd.nr c-cnrc.gc.ca (Walter Roberson)
wrote:
In article <7J-dnX6UeKWCWiTanZ 2dnUVZ8sDin...@ bt.com>,
Richard Heathfield <r...@see.sig.i nvalidwrote:
>
>
>
>
I have the official ANSI C89 hard-copy publication. It describes
the integer formats in two related paragraphs, the first of which
is a summary for all of the formats and uses "int", and the second
of which is specific to o,u,x,X and uses "unsigned int".
Richard Heathfield <r...@see.sig.i nvalidwrote:
>
>
>
Harald van D?k said:
Hmmm. Okay, so that's (perhaps) Yet Another Difference between C89 and C99
- and a potentially significant one, since it causes difficulty for those
wishing to program in the common subset of the two languages. I say
"perhaps" because my source doc for C89 is (pace, C.H.!) a mere draft, and
as such is suspect in cases like this. Does anyone have a kosher copy of
the "real" C89 in which they could check this out?
On Mon, 18 Feb 2008 17:22:37 +0000, Richard Heathfield wrote:
>Keith Thompson said:
>>Richard Heathfield <r...@see.sig.i nvalidwrites:
>>>Actually, %x takes an int, not a hex. C doesn't have a hex type.
>>Actually, %x takes an unsigned int.
>4.9.6.1 of C89:
>d, i, o, u, x, X The int argument is converted to signed decimal ( d
> or i ), unsigned octal ( o ), unsigned decimal ( u ), or unsigned
> hexadecimal notation ( x or X );
>Sure looks like int to me.
Interesting. C99 7.19.6.1p8:
o,u,x,X The _unsigned int_ argument is converted to unsigned octal (o),
unsigned decimal (u), or unsigned hexadecimal notation (x or X)
in the style /dddd/; [...]
>Keith Thompson said:
>>Richard Heathfield <r...@see.sig.i nvalidwrites:
>>>Actually, %x takes an int, not a hex. C doesn't have a hex type.
>>Actually, %x takes an unsigned int.
>4.9.6.1 of C89:
>d, i, o, u, x, X The int argument is converted to signed decimal ( d
> or i ), unsigned octal ( o ), unsigned decimal ( u ), or unsigned
> hexadecimal notation ( x or X );
>Sure looks like int to me.
Interesting. C99 7.19.6.1p8:
o,u,x,X The _unsigned int_ argument is converted to unsigned octal (o),
unsigned decimal (u), or unsigned hexadecimal notation (x or X)
in the style /dddd/; [...]
- and a potentially significant one, since it causes difficulty for those
wishing to program in the common subset of the two languages. I say
"perhaps" because my source doc for C89 is (pace, C.H.!) a mere draft, and
as such is suspect in cases like this. Does anyone have a kosher copy of
the "real" C89 in which they could check this out?
I have the official ANSI C89 hard-copy publication. It describes
the integer formats in two related paragraphs, the first of which
is a summary for all of the formats and uses "int", and the second
of which is specific to o,u,x,X and uses "unsigned int".
the ANSI one (because the ISO one has two paragraphs, one for 'i,d',
and another one for 'o,u,x,X')? Is there a list of changes somewhere?
Yevgen
Comment