M
madhawi
This question is occur in interview. Please help me.
What question?madhawi said:This question is occur in interview. Please help me.
no chapter and verse, but I believe that is implementatiion defined.How many levels of pointers can you have?
madhawi said:Subject: How many levels of pointers can you have?
This question is occur in interview. Please help me.
This question is occur in interview. Please help me.
This question is occur in interview. Please help me.
Ben said:Twelve:
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:13)
[...]
- 12 pointer, array, and function declarators (in any
combinations) modifying an arithmetic, structure, union,
or incomplete type in a declaration
Kenneth Brody said:Now _there's_ a question for the standards committee... Where did
they pick the number 12 from?
One member wanted 8, another wanted 16, they compromised on 12?
Kenneth Brody said:"At least 12."
madhawi said:This question is occur in interview. Please help me.
Kenneth said:Ben said:Twelve:
"At least 12."
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:13)
[...]
- 12 pointer, array, and function declarators (in any
combinations) modifying an arithmetic, structure, union,
or incomplete type in a declaration
Now _there's_ a question for the standards committee... Where did
they pick the number 12 from?
Kenneth said:Now _there's_ a question for the standards committee... Where did
they pick the number 12 from?
Ben said:Twelve:
Kenneth said:Ben said:Subject: How many levels of pointers can you have?
This question is occur in interview. Please help me.
Twelve:
"At least 12."
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:13)
[...]
- 12 pointer, array, and function declarators (in any
combinations) modifying an arithmetic, structure, union,
or incomplete type in a declaration
Now _there's_ a question for the standards committee... Where did
they pick the number 12 from?
Maybe all the compilers allowed "as many as you like (until we
run out of store)", except one that had a 4-bit field for
"number of indirections" in a type with the top three values
reserved for "struct", "union", or "function pointer".
John Cochran said:I have a vague memory from many years back about what I believe was a
Honeywell mainframe (36 bit words, 18 bit addressing). One of the features
of this beast was indirect addressing where if a bit was set in a word
when it was accessed, it indicated that the word should be used as an
address pointing to where the actual parameter was. And if *that* had that
magic bit set, then it was also an address pointing to where the actual
parameter was. This indirection could in theory go quite a distance. However
the computer would throw an exception if too many levels of indirection
were being used. I don't remember how many levels this was.
But given that the above feature could be used to implement pointer to pointer
to ..... in a fairly efficient C implementation. I can see a "must be able
to do at least X levels of indirection" requirement based upon the limits
of the computers with this capability.
Now this is pure speculation, but I wouldn't be surprised if there exists
a modern computer that has this indirect capability and has a limit on
how many levels of indirection it's willing to perform without causing
an exception.
Ben Pfaff said:madhawi said:Subject: How many levels of pointers can you have?
This question is occur in interview. Please help me.
Twelve:
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:13)
[...]
- 12 pointer, array, and function declarators (in any
combinations) modifying an arithmetic, structure, union,
or incomplete type in a declaration
I wonder if anybody ever made a non toy program with 12 levels of pointers.
http://groups.google.co.nz/group/alt.comp.lang.learn.c-c++/msg/6a167ce376b99b14Does this count?
Now _there's_ a question for the standards committee... Where did
they pick the number 12 from?
You might know you might not.madhawi said:This question is occur in interview. Please help me.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.