[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::digital_unix

Title:DIGITAL UNIX(FORMERLY KNOWN AS DEC OSF/1)
Notice:Welcome to the Digital UNIX Conference
Moderator:SMURF::DENHAM
Created:Thu Mar 16 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:10068
Total number of notes:35879

10033.0. "32767 max number of lines in a C program ??" by SPANIX::JULIANR (ALPHAbet = Our bet on ALPHA) Tue Jun 03 1997 13:05

	Hi all.

	One of out partners is trying to port an Informix 4GL application 
to Digital UNIX. It successfully works on DG, IBM and HP.

	They have a large number of source files (800), each one having up 
to 13,500 lines of 4GL code. When these 4GL sources are compiles, they 
generate I/SQL-C sources which in turn are preprocessed by the Informix I/
SQL-C preprocessor. Finally, the results are compiled by our DEC C compiler 
and the following error appear (more or less):

	cc: Warning 4gl_source.ec
		Line 32768 is greater than the maximum specified by ANSI
		and may not be protable
	...

The same happens for every line in the following twenty thousand of them 
until the process is finally cancelled.

Is there such a limit (32767) in our DEC C compiler for the number of lines a 
C program may contain ?

May that limit be increased ?


Best regards,

Juli�n Rodr�guez
Digital Spain
874-4192
T.RTitleUserPersonal
Name
DateLines
10033.1The problem is #line, not lines in programDECC::SULLIVANJeff SullivanTue Jun 03 1997 14:0639
This warning complains about a #line directive that is out of range according to
ANSI C, section 3.3.4, line 12:
 
  "The digit sequence shall not specify zero, nor a number greater than 32767"


The following simple program will demonstrate the problem:

% cc t.c
cc: Warning: line32767.c, line 32768: Line number is greater than the 32767
specified by ANSI and may not be portable.
#line 32768  line32768.c
------^

% a.out
t.c: line 5
line32767.c: line 32767
line32768.c: line 32768

% cat t.c
#include <stdio.h>

void main()
{
  printf("%s: line %d\n", __FILE__, __LINE__); 
#line 32767  line32767.c
  printf("%s: line %d\n", __FILE__, __LINE__); 
#line 32768  line32768.c
  printf("%s: line %d\n", __FILE__, __LINE__); 
}


Note that in -std0 we get the warning. I think it needs to be there in -std and
-std1, but it may be allowable in -std0. I'll ask about that.

In any case, the #line directive "does the right thing". Note that the __LINE__
is set to a number greater than 32767, even with the warning.

-Jeff
10033.2#pragma message disable xtralargeDECC::SULLIVANJeff SullivanTue Jun 03 1997 14:2626
You can determine the message id for that message by adding the -verbose switch.
Once you get the message id, you can disable just that message, using #pragma
message disable line, as shown below:

  #pragma message disable xtralarge

% cat t.c
#ifdef QUIET
#pragma message disable xtralarge
#endif

#line 32768
int i;

% cc t.c -c
cc: Warning: t.c, line 5: Line number is greater than the 32767 specified by
ANSI and may not be portable.
#line 32768
------^

% cc t.c -c -DQUIET
% 

You could add that in one place to a common header file (hopefully).

-Jeff