Re: printf and cout
Bernhard Schauer said:
>>
>The %c format expects (and thus treats the corresponding argument as) an
>unsigned char.
>
Ok. But I hope char(400) does not convert to an unsigned char?
Actually, char(400) converts to a syntax error.
--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Bernhard Schauer said:
>><snip>
>>>Actually they don't behave differently at all. In each case the int
>>>value 400 is being interpreted as an unsigned char.
>><snip>
>>>
>>Code from laikon:
>>>int c = 400;
>>>printf("%c ", c);
>>>cout << int(char(400));
>>>
>>Where exactly do you see unsigned characters? (char != unsigned char)
>>>Actually they don't behave differently at all. In each case the int
>>>value 400 is being interpreted as an unsigned char.
>><snip>
>>>
>>Code from laikon:
>>>int c = 400;
>>>printf("%c ", c);
>>>cout << int(char(400));
>>>
>>Where exactly do you see unsigned characters? (char != unsigned char)
>The %c format expects (and thus treats the corresponding argument as) an
>unsigned char.
Ok. But I hope char(400) does not convert to an unsigned char?
--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Comment