Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
65 Views

C Language Reference, and identifier lengths (follow-up)

 

Followup to: https://software.intel.com/en-us/forums/intel-c-compiler/topic/736065

This question was answered by providing a link to the compiler reference, thanks.

But actually, I am looking for a language reference, not a compiler reference, and I originally posted because I haven't been able to find a language reference in the compiler reference. Nor have I been able to find the identifier length limits.

Thanks,
Kevin

0 Kudos
2 Replies
Highlighted
65 Views

http://en.cppreference.com/w/c/language/identifier

C:

Translation limits

Even though there is no specific limit on the length of identifiers, early compilers had limits on the number of significant initial characters in identifiers and the linkers imposed stricter limits on the names with external linkage. C requires that at least the following limits are supported by any standard-compliant implementation:

  • 31 significant initial characters in an internal identifier or a macro name
  • 6 significant initial characters in an external identifier
  • 511 external identifiers in one translation unit
  • 127 identifiers with block scope declared in one block
  • 1024 macro identifiers simultaneously defined in one preprocessing translation unit
(until C99)
  • 63 significant initial characters in an internal identifier or a macro name
  • 31 significant initial characters in an external identifier
  • 4095 external identifiers in one translation unit
  • 511 identifiers with block scope declared in one block
  • 4095 macro identifiers simultaneously defined in one preprocessing translation unit

And

http://en.cppreference.com/w/cpp/language/identifiers

C++

An identifier is an arbitrarily long sequence of digits, underscores, lowercase and uppercase Latin letters, and most Unicode characters (see below for details). A valid identifier must begin with a non-digit character (Latin letter, underscore, or Unicode non-digit character). Identifiers are case-sensitive (lowercase and uppercase letters are distinct), and every character is significant

IOW length not defined (at least in that reference).

Jim Dempsey

0 Kudos
Highlighted
Beginner
65 Views

Jim,

Thanks! So you're saying specifically that the Intel compiler itself has no explicit limits, even for C identifiers. That's what I suspected, based on its interest in being compatible with other compilers (especially gcc in this respect) and its code sharing with C++. Is this fact documented anywhere? This kind of information is highly useful for those wishing to write code with this compiler in mind, given the variances amongst compilers.

Yes, I am aware of the ANSI minima; I am just surveying active compilers and linkers to see what the effective minima are.

Is there a C language reference for the compiler, other than references to the ANSI standards?

Thanks,
Kevin

0 Kudos