Search code examples
c++climit

What is max length for an C/C++ identifier on common (build) systems?


I don't remember the standard saying something of the max length for identifiers so in theory they can be long. In real life, those names could be limited by at least the compiler and linker implementations.

While this should work on all systems

int a;

this snippet

#!/usr/bin/perl
print "int" . "b" x 2**16 . ";";

creates a declarationen that gives undefined reference to std::somethings with ld while compiling/linking (using gcc/mingw).

So what are the size limits for an identifier on different systems?


Solution