Is the following code OK?

P

Peter Pichler

pete said:
Eric Sosman is right.

N869 or C99
6.4.4.1 Integer constants

ISO/IEC 9899: 1990
6.1.3.2 Integer constants
The type of an integer constant is the first of the
corresponding list in which its value can be represented.
Unsuffixed decimal:
int, long int, unsigned long int;
unsuffixed octal or hexadecimal:
int, unsigned int, long int, unsigned long int;

Damn, you are right! I don't know where I got it from. Must have been an
extrapolation from either char escape sequences -

"The value of an octal or hexadecimal escape sequence shall be in the
range of representable values for the type unsigned char for an integer
character constant, or the unsigned type corresponding to wchar_t for a
wide character constant."

- or printf conversion specifiers -

"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; the letters abcdef are used for x conversion and the letters
ABCDEF for X conversion. The precision specifies the minimum number of
digits to appear; if the value being converted can be represented in
fewer digits, it is expanded with leading zeros. The default precision
is 1. The result of converting a zero value with a precision of zero is
no characters."

My humble apologies,

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,169
Messages
2,570,915
Members
47,456
Latest member
JavierWalp

Latest Threads

Top