At least the first 31 characters of an internal name are significant. For function names and external variables, the number may be less than 31, because external names may be used by assemblers and loaders over which the language has no control. For external names, the standard guarantees uniqueness only for 6 characters and a single case.
Each compiler is free to choose appropriate sizes for its own hardware, subject only to the the restriction that shorts and ints are at least 16 bits, longs are at least 32 bits, and short is no longer than int, which is no longer than long.
The type long double specifies extended-precision floating point. As with integers, the sizes of floating-point objects are implementation-defined; float, double and long double could represent one, two or three distinct sizes.
An integer constant like 1234 is an int. A long constant is written with a terminal l (ell) or L, as in 123456789L; an integer constant too big to fit into an int will also be taken as a long. Unsigned constants are written with a terminal u or U, and the suffix ul or UL indicates unsigned long.
Floating-point constants contain a decimal point (123.4) or an exponent (1e-2) or both; their type is double, unless suffixed. The suffixes f or F indicate a float constant; l or L indicate a long double.
The value of an integer can be specified in octal or hexadecimal instead of decimal. A leading 0 (zero) on an integer constant means octal; a leading 0x or 0X means hexadecimal.
Octal and hexadecimal constants may also be followed by L to make them long and U to make them unsigned: 0XFUL is an unsigned long constant with value 15 decimal.
an arbitrary byte-sized bit pattern can be specified by
'\ooo'
where ooo is one to three octal digits (0...7) or by
'\xhh'
where hh is one or more hexadecimal digits (0...9, a...f, A...F).
紧邻的两个字符串常量会被合并成一个,不管中间间隔了多少空白字符。例如:
$ cat main.c
#include
int main(int argc, char **argv) {
char *word = "hello " "world1";
char *word2 = "hello "
"world2";
printf("%s\n%s\n", word, word2);
return 0;
}
$ ./a.out
hello world1
hello world2
$
The first name in an enum has value 0, the next 1, and so on, unless explicit values are specified. If not all values are specified, unspecified values continue the progression from the last specified value.
虽然ANSI C中有const关键字,但The result is implementation-defined if an attempt is made to change a const.
The direction of truncation for / and the sign of the result for % are machine-dependent for negative operands, as is the action taken on overflow or underflow.
我以前一直不确定这是不是标准保证的:By definition, the numeric value of a relational or logical expression is 1 if the relation is true, and 0 if the relation is false.现在确定了。
阅读(734) | 评论(1) | 转发(0) |