what does it mean: "line out of range" ?

Michael Gong mwgong@cs.utoronto.ca
Thu Mar 8 21:39:00 GMT 2007


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.

Is it appropriate ?

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 

there should not be such a limit of 32767.

Can anyone clarify it ?



More information about the Gcc-help mailing list