"Michael Gong" <mwgong@xxxxxxxxxxxxxx> writes: > I have a file : foo.c, which is like: > > #line 20 "./.acc_dir/c-typeck.c" > int main() { > > #line 39309 "./.acc_dir/c-typeck.c" <-- if change to 32767, > no warning message below > return 3; > } > > > >gcc -c foo.c -pedantic > ./.acc_dir/c-typeck.c:22:7: warning: line number out of range. > > > It seems that when the line number > 32767, which is the max of short > int, the warning message is issued. So I assume gcc uses a short int > to store the line number. No. You will notice that you only get the warning with -pedantic. gcc is warning because C89 has a limit of 32767. > According to C99, > > # line digit-sequence new-line > > causes the implementation to behave as if the following sequence of > source lines begins with a source line that has a line number as > specified by the digit sequence (interpreted as a decimal > integer). The digit sequence shall not specify zero, nor a number > greater than 2147483647. Yes, C99 raised the limit. If you compile with -std=c99 or -std=gnu99, you will not get the warning. gcc defaults to gnu89 mode. Ian