void openfile(char *,FILE**)
what does double stars indicates
The second argument type is a pointer to a pointer to FILE type.
Didn't you understand what's a pointer?
Evidently this function returns FILE* pointer via this argument. What's a strange perversion...
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
>>you have to pass in an address
Not if you pass NULL.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
How many times a pointer operator can appear with pointer to pointer declaration.
int a;
int *p;
int **q;
int ***r;
int ****s;
....
p=&a;
q=&p;
r=&q;
s=&r;
...
Is there any limit imposed by ANSI?
__avd
Posting Genius (adatapost)
8,648 posts since Oct 2008
Reputation Points: 2,136
Solved Threads: 1,241
That's it:
5.2.4.1 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.
(256 in C++)
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
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.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
curious, did you incrementally compile 1 additional indirection operator each time? did you use a scripting language to do it?
jephthah
Posting Maven
2,587 posts since Feb 2008
Reputation Points: 2,143
Solved Threads: 179
>Isn't 16 *'s maximum in C ???
I have never seen maximal values of translation limits were defined in C docs.
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
>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 ;)
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
The way I found out the limits was to write a program that had a pointer with a bunch of stars.
>>did you incrementally compile 1 additional indirection operator each time?
Suuuure I did, and compiled it over 900 times just for this thread. And if you believe that I have some stocks in the Golden Gate Bridge I'll sell you :)
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
The way I found out the limits was to write a program that had a pointer with a bunch of stars.
>>did you incrementally compile 1 additional indirection operator each time?
Suuuure I did, and compiled it over 900 times just for this thread. And if you believe that I have some stocks in the Golden Gate Bridge I'll sell you :)
um, well, it would a fairly trivial matter to do so using Perl or some other scripting language. but i agree with you that we have better ways to spend our time.
just what i was wondering is along the lines of "hey great, so 900 stars fails..." but does 850? or 800? or 500? or 100?
IOW, where'd you get your magic number of 900?
.
jephthah
Posting Maven
2,587 posts since Feb 2008
Reputation Points: 2,143
Solved Threads: 179
>>IOW, where'd you get your magic number of 900?
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.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343