184.108.40.206 Translation limits
1 The implementation shall be able to translate and execute at least one program that contains at least one instance of every one of the following limits:
- 12 pointer, array, and function declarators (in any combinations) modifying an arithmetic, structure, union, or incomplete type in a declaration
Implementations should avoid imposing fixed translation limits whenever possible.
With VC++ 2008 Express, compiling a C program, I was able to compile char*(500 stars) ptr = "Hello"; before the parser complained. And then the error message was "parser stack overflow, program too complex"
Interestingly, as a c++ program I was able to give it about 920 stars before the compiler crapped out -- then it was during the link stage, not the compile stage.
>Isn't 16 *'s maximum in C ???
I have never seen maximal values of translation limits were defined in C docs.
Well I had seen it being limited in some early versions of cc gcc and all .Actually had read about them somewhere "Not quite sure though".So asked it here.But don't know how Ancient Dragon found out the limit,but 500 and 920 are quite surprising !!!
@Ancient Dragon : Can I get the link where you found that out ? Or atleast the method ? And what do you think is the limit for POSIX and C99 compliant gcc version?
>Well I had seen it being limited in some early versions of cc gcc and all.
It was not the C language limit, it's a limit of the compiler (implementation),
>...Or atleast the method...
Generate a probe module by a simplest program in C then use binary search ;)
trial and error. It was actually about 912. Held down the star key until 900+ stars appeared then tried to compile. When the compiler crapped out I backed out a few stars until I got a clean compile/link. My guess is that the compiler pushes something on the stack for each star.