By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,305 Members | 1,588 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,305 IT Pros & Developers. It's quick & easy.

How many levels of pointers can you have?

P: n/a
This question is occur in interview. Please help me.

Jun 6 '07 #1
Share this Question
Share on Google+
158 Replies


P: n/a
"madhawi" <ma*******@gmail.comschrieb im Newsbeitrag
news:11*********************@z28g2000prd.googlegro ups.com...
This question is occur in interview. Please help me.
What question?

Ahh, in the Subject... don't hide it there.
>How many levels of pointers can you have?
no chapter and verse, but I believe that is implementatiion defined.
Jun 6 '07 #2

P: n/a
madhawi <ma*******@gmail.comwrites:
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

--
Comp-sci PhD expected before end of 2007
Seeking industrial or academic position *outside California* in 2008
Jun 6 '07 #3

P: n/a
In article <11*********************@z28g2000prd.googlegroups. com>,
madhawi <ma*******@gmail.comwrote:
>This question is occur in interview. Please help me.
At least 12. (See the section "Declarators" in the standard.)

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Jun 6 '07 #4

P: n/a
On Jun 6, 9:40 pm, madhawi <madhaw...@gmail.comwrote:
This question is occur in interview. Please help me.
answer of course is implementation specific. if my memory is correct i
think it is 71 levels of indirection in borland turbo c++ version 3.0
compiler.

Jun 6 '07 #5

P: n/a
Ben Pfaff wrote:
>
madhawi <ma*******@gmail.comwrites:
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?

--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h|
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:Th*************@gmail.com>
Jun 6 '07 #6

P: n/a
Kenneth Brody <ke******@spamcop.netwrites:
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?
--
Ben Pfaff
http://benpfaff.org
Jun 6 '07 #7

P: n/a
Ben Pfaff said:
Kenneth Brody <ke******@spamcop.netwrites:
>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?
No no no. It's a committee! One member wanted 16, another wanted 16,
another wanted 16, and quite a few more wanted 16, and everybody else
also wanted 16, so they compromised on 12.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Jun 6 '07 #8

P: n/a
"Kenneth Brody" <ke******@spamcop.netwrote in message
news:46***************@spamcop.net...
Ben Pfaff wrote:
>>
madhawi <ma*******@gmail.comwrites:
Subject: How many levels of pointers can you have?

This question is occur in interview. Please help me.

Twelve:

"At least 12."
So yeah, 12 is safe everything above that is implementation defined.
I wonder if anybody ever made a non toy program with 12 levels of pointers.

Jun 6 '07 #9

P: n/a
madhawi wrote:
This question is occur in interview. Please help me.
One: a pointer points to its target, and that's that.

--
Eric Sosman
es*****@acm-dot-org.invalid
Jun 6 '07 #10

P: n/a
Kenneth Brody wrote:
Ben Pfaff wrote:
>>
madhawi <ma*******@gmail.comwrites:
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".

--
Speculative Faction Hedgehog
Otherface: Jena RDF/Owl toolkit http://jena.sourceforge.net/

Jun 6 '07 #11

P: n/a
Kenneth Brody wrote:
Now _there's_ a question for the standards committee... Where did
they pick the number 12 from?
from C89

--
Tor <torust [at] online [dot] no>

Jun 6 '07 #12

P: n/a
Ben Pfaff wrote:
>
madhawi <ma*******@gmail.comwrites:
Subject: How many levels of pointers can you have?

This question is occur in interview. Please help me.

Twelve:
/* BEGIN new.c */

#include <stdio.h>

int main(void)
{
(************puts)("Cool!!!");
return 0;
}

/* END new.c */

--
pete
Jun 6 '07 #13

P: n/a
In article <4c*******************@fe2.news.blueyonder.co.uk >,
Chris Dollin <eh@electrichedgehog.netwrote:
>Kenneth Brody wrote:
>Ben Pfaff wrote:
>>>
madhawi <ma*******@gmail.comwrites:

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".
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.
Jun 6 '07 #14

P: n/a
In article <f4***********@smof.fiawol.org>,
John Cochran <jd*@smof.fiawol.orgwrote:
>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.
I doubt C has ever been implemented on that architecture by setting
the relevant bit in pointers. If we have char *****p, then both **p
and ****p are legal expressions: the number of dereferences is
controlled by the program, not the data. C doesn't have a
"dereference as much as you can" operator.
>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.
I *would* be surprised if there was such a modern computer.

In any case, the limit in C89 - which is a limit on types, not
dereferencing of objects - most likely just reflects how some common
existing implementation handled declarations.

-- Richard

--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Jun 6 '07 #15

P: n/a
Ben Pfaff <bl*@cs.stanford.eduwrites:
madhawi <ma*******@gmail.comwrites:
>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
Yes, but like all the limits in 5.2.4.1, it doesn't necessarily mean
very much. A conforming implementation is merely required to
translate and execute *one* program that hits all the listed limits.
Another program with 12 levels of pointers might fail to compile.

The point of the requirement, I think, is that the easiest way to
satisify it is not to have any fixed limits at all, by making the
relevant data structures within the compiler dynamic. A typical
compiler most likely won't complain about 13, or 20, or 99 levels of
pointers (unless it issues a warning).

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 6 '07 #16

P: n/a
On Jun 7, 8:49 am, "Kira" <a...@n.tkwrote:
I wonder if anybody ever made a non toy program with 12 levels of pointers.
Does this count? :)
http://groups.google.co.nz/group/alt...167ce376b99b14

Jun 6 '07 #17

P: n/a
Old Wolf said:
On Jun 7, 8:49 am, "Kira" <a...@n.tkwrote:
>I wonder if anybody ever made a non toy program with 12 levels of
pointers.

Does this count? :)
http://groups.google.co.nz/group/alt...167ce376b99b14
That was a pretty fun thread from top to bottom.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Jun 7 '07 #18

P: n/a
Kenneth Brody wrote:
Ben Pfaff wrote:
>madhawi <ma*******@gmail.comwrites:
>>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?
I suspect a vote, about 20 years ago, long forgotten.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
<http://kadaitcha.cx/vista/dogsbreakfast/index.html>
cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

Jun 7 '07 #19

P: n/a
On Wed, 06 Jun 2007 15:59:57 -0400, Kenneth Brody
<ke******@spamcop.netwrote:
>Now _there's_ a question for the standards committee... Where did
they pick the number 12 from?
I think they just doubled the 6 guaranteed by K&R. Studies showed
that some complicated code used 6 or more indirections but that
virtually no code used more than 10.

George
--
for email reply remove "/" from address
Jun 7 '07 #20

P: n/a

"madhawi" <ma*******@gmail.comwrote in message
news:11*********************@z28g2000prd.googlegro ups.com...
This question is occur in interview. Please help me.
You might know you might not.
The point is that the standard imposes some limit which is way above the
number of dereferences any paractical programmer would ever need. All
computers will eventually run out of memory if you try to impose a stupidly
large number, even if it is 4 billion.

As it stands it is rather a bad question. It tells you who knows every
irrelevant detail of the stnadard, but that only has a slight correlation to
broader abilities. However remember that the interviewer isn't really
interested in technical ability - he knows that from your CV - he wants to
find out what sort of person you are. So given that you don't know, how do
you handle that? If you can do it in a graceful and relaxed manner, but not
too arrogant - they are looking for teamworking skills, aka obedience, after
all - then you should do well.
--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Jun 7 '07 #21

P: n/a
On Jun 7, 3:49 am, "Kira" <a...@n.tkwrote:
I wonder if anybody ever made a non toy program
with 12 levels of pointers.
Here's a program that uses 11 levels of pointers.
(It would have 12 but avoided the last level with
a "micro-optimization.")

http://james.fabpedigree.com/wnim.htm

Since the program was written in response
to a "non-life threatening" query in rec.puzzles,
I suppose it could be considered a "toy",
but the webpage poses a challenge: If this is
not the best way to solve the stated problem,
what is?

jamesdowallen at gmail
Jun 7 '07 #22

P: n/a
James Dow Allen <jd*********@yahoo.comwrote:
On Jun 7, 3:49 am, "Kira" <a...@n.tkwrote:
I wonder if anybody ever made a non toy program
with 12 levels of pointers.

Here's a program that uses 11 levels of pointers.
(It would have 12 but avoided the last level with
a "micro-optimization.")

http://james.fabpedigree.com/wnim.htm

Since the program was written in response
to a "non-life threatening" query in rec.puzzles,
I suppose it could be considered a "toy",
but the webpage poses a challenge: If this is
not the best way to solve the stated problem,
what is?
I'd have devised a way to encode the board, perhaps in a string, perhaps
in an unsigned long long if possible, and then used a one-dimensional
table of those. That's easier to extend to larger boards, for one thing.

Richard
Jun 7 '07 #23

P: n/a
Malcolm McLean wrote:
"madhawi" <ma*******@gmail.comwrote in message
>This question is occur in interview. Please help me.

You might know you might not. The point is that the standard
imposes some limit which is way above the number of dereferences
any paractical programmer would ever need. All computers will
eventually run out of memory if you try to impose a stupidly
large number, even if it is 4 billion.
Why? All the dereference requires is to replace the pointer with
what it points to. Repeat as each '*' appears in the input. At
most this requires games with the input stream, such as counting
'*'s while advancing to the base pointer.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
<http://kadaitcha.cx/vista/dogsbreakfast/index.html>
cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

Jun 7 '07 #24

P: n/a
Kenneth Brody <ke******@spamcop.netwrote:
>
Now _there's_ a question for the standards committee... Where did
they pick the number 12 from?
As I recall, that was the limit in Ritchie's original compiler and no
one ever complained that it was too small, so the committee went with
it.

-Larry Jones

Even though we're both talking english, we're not speaking the same language.
-- Calvin
Jun 7 '07 #25

P: n/a
la************@ugs.com writes:
Kenneth Brody <ke******@spamcop.netwrote:
>Now _there's_ a question for the standards committee... Where did
they pick the number 12 from?

As I recall, that was the limit in Ritchie's original compiler and no
one ever complained that it was too small, so the committee went with
it.

-Larry Jones
Somebody here said that K&R (presumably the first edition) guarantees
6 levels. I don't have my copy handy to check this, but presumably
that would match what Ritchie's original compiler supported.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 7 '07 #26

P: n/a
>>>>"MML" == Malcolm McLean <re*******@btinternet.comwrites:

MMLHowever remember that the interviewer isn't really interested
MMLin technical ability - he knows that from your CV -

Er, you haven't seen some of the resumes I've seen, then, and
subsequently interviewed the candidates with the same name at the top
of the resume. The technical ability described on the resume may have
nothing at all to do with the technical ability possessed by the
candidate, and it is an irresponsible interviewer who does not
evaluate the candidate in front of him separately from what the resume
claims.

Charlton


--
Charlton Wilbur
cw*****@chromatico.net
Jun 8 '07 #27

P: n/a
Charlton Wilbur wrote:
>>>>>"MML" == Malcolm McLean <re*******@btinternet.comwrites:

MMLHowever remember that the interviewer isn't really interested
MMLin technical ability - he knows that from your CV -

Er, you haven't seen some of the resumes I've seen, then, and
subsequently interviewed the candidates with the same name at the top
of the resume. The technical ability described on the resume may have
nothing at all to do with the technical ability possessed by the
candidate, and it is an irresponsible interviewer who does not
evaluate the candidate in front of him separately from what the resume
claims.
Seconded. I once found myself in a most embarrassing position
as an interviewee for a post I was not qualified for (nor interested
in). About five minutes into the interview, after I had answered
the Nth question in a row with "I dunno," the interviewer asked me
why in the world my resume claimed expertise in this area I was so
obviously unfamiliar with. I asked to see the resume, and to my
horror discovered that my headhunter had transformed my original
into a complete fabrication: He'd left my name intact, but just
invented most of the rest. I disavowed the fiction and promptly
on the next morning fired the headhunter -- but the damage was done;
even if the firm in question had a job for which I *was* suited, I
doubt they'd have hired me after that fiasco.

There are diligent and capable headhunters out there, but there
are also some utter sleazebags. "Trust, but verify."

--
Eric Sosman
es*****@acm-dot-org.invalid

Jun 9 '07 #28

P: n/a
Eric Sosman said:

<snip>
I once found myself in a most embarrassing position
as an interviewee for a post I was not qualified for (nor interested
in). About five minutes into the interview, after I had answered
the Nth question in a row with "I dunno," the interviewer asked me
why in the world my resume claimed expertise in this area I was so
obviously unfamiliar with. I asked to see the resume, and to my
horror discovered that my headhunter had transformed my original
into a complete fabrication: He'd left my name intact, but just
invented most of the rest. I disavowed the fiction and promptly
on the next morning fired the headhunter -- but the damage was done;
even if the firm in question had a job for which I *was* suited, I
doubt they'd have hired me after that fiasco.
One possible defence is to take your own copy of your CV to the
interview, so that you can show it to the interviewer during your
apology (which apology, by rights, the *headhunter* should be making).

I am, however, a little surprised that you got as far as the interview
stage without you yourself having found out about their requirements.
Two possibilities spring to mind - (a) a work-cultural difference
between your country and mine; (b) the headhunter was lying to *you*,
too. One cannot help but wonder what his motivation was, though. Trying
to bang Eric-shaped pegs into non-Eric-shaped holes must surely be a
losing proposition for all concerned.

For the record, if I'd been the interviewer I'd have said, "what, THE
Eric Sosman? Okay, never mind, we have THIS job for you instead..."

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Jun 9 '07 #29

P: n/a
Richard Heathfield wrote:
[...]
For the record, if I'd been the interviewer I'd have said, "what, THE
Eric Sosman? Okay, never mind, we have THIS job for you instead..."
A thousand thanks, but in that long-past time I was
not yet THE Eric Sosman; I was just Eric Sosman, young and
dumb. Nowadays I'm THE Eric Sosman, senile but cunning.

--
Eric Sosman
es*****@acm-dot-org.invalid

Jun 9 '07 #30

P: n/a
Eric Sosman wrote:
Richard Heathfield wrote:
>[...]
For the record, if I'd been the interviewer I'd have said, "what, THE
Eric Sosman? Okay, never mind, we have THIS job for you instead..."

A thousand thanks, but in that long-past time I was
not yet THE Eric Sosman; I was just Eric Sosman, young and
dumb. Nowadays I'm THE Eric Sosman, senile but cunning.
Now, there's a sig. line!!!!

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
<http://kadaitcha.cx/vista/dogsbreakfast/index.html>
cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

Jun 9 '07 #31

P: n/a

"Charlton Wilbur" <cw*****@chromatico.netwrote in message
news:87************@mithril.chromatico.net...
>>>>>"MML" == Malcolm McLean <re*******@btinternet.comwrites:

MMLHowever remember that the interviewer isn't really interested
MMLin technical ability - he knows that from your CV -

Er, you haven't seen some of the resumes I've seen, then, and
subsequently interviewed the candidates with the same name at the top
of the resume. The technical ability described on the resume may have
nothing at all to do with the technical ability possessed by the
candidate, and it is an irresponsible interviewer who does not
evaluate the candidate in front of him separately from what the resume
claims.
Maybe that says more about the interview process than the candidate. That is
particularly true of computers. Put someone in front of an unfamiliar system
and he won't even know how to log on. That doesn't mean that within a few
days he won't be perfectly competent and productive.

Questions like "how many levels of indirection does C allow?" tell you a
little bit, but not much. Some programmers don't even use the term
"indirection", though they know what the concept means. An experienced
programmer might say "I don't know", because it is just a bit of trivia of
no real interest to anyone not actually implementing a compiler.

If people are coming to you claiming two years' experience as a C programmer
developing desktop apps with Blogg's corps, or possessing a degree in
computer studies, and seemingly now knowing basic things, then you really
need to look at what is going on. Whilst the candidate is trying to sell
himself and put a good gloss on his achievements, outright lying is
relatively rare, and in Britain at least is illegal. It could be that people
are elevating trivial exposure to something into wide experience, but then
you might be making the mistake of saying "we need someone who knows how to
log on to Unix".

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm
Jun 9 '07 #32

P: n/a
On Jun 7, 6:06 pm, r...@hoekstra-uitgeverij.nl (Richard Bos) wrote:
James Dow Allen <jdallen2...@yahoo.comwrote:
but the webpage poses a challenge: If this is
not the best way to solve the stated problem,
what is?

I'd have devised a way to encode the board, perhaps in a string, perhaps
in an unsigned long long if possible, and then used a one-dimensional
table of those. That's easier to extend to larger boards, for one thing.
Yes, the one-dimensional table would be a hash table.
Readability is partly in beholder's eyes, but I'll
admit my choice gave high priority to whimsy, and
speed of *writing* (this was a program I never intended
to modify further, and "better" approaches would have
taken slightly longer to write, if less time to read).

Nevertheless, many-dimension sparse arrays would seem
an obvious case where "many levels of pointers"
could get used up quickly.

I'm sure there are many examples of
foo->bar->baz
in the Unix kernel.
Since an 'indent | grep' script would be easy to
write, it might be fun to look for any examples
of
foo->bar->baz->garf->grook
in real code.

James

Jun 9 '07 #33

P: n/a
James Dow Allen wrote:
>
Nevertheless, many-dimension sparse arrays would seem
an obvious case where "many levels of pointers"
could get used up quickly.

I'm sure there are many examples of
foo->bar->baz
in the Unix kernel.
Since an 'indent | grep' script would be easy to
write, it might be fun to look for any examples
of
foo->bar->baz->garf->grook
in real code.

James
Ooops, do you say that there might be a compiler dependent limits to the
number of a->b->c... levels i might use in a statement? I am probably
not using 12 or more, but probably not that far off at some places...
(I have a program where I have implemented object oriented programming
in C, (I didn't use C++ because it is also at the same time a plugin
structure using windows DLL:s, and those are a real pain i C++ BTDT)
using between two and four different structs for each hierarchy level,
and reaching a function pointer in the base "class" requires one -for
each level plus two)
Jun 9 '07 #34

P: n/a
In article <f4**********@news1.zwoll1.ov.home.nl>, Kira <as**@n.tk>
writes
>"Kenneth Brody" <ke******@spamcop.netwrote in message
news:46***************@spamcop.net...
>Ben Pfaff wrote:
>>>
madhawi <ma*******@gmail.comwrites:

Subject: How many levels of pointers can you have?

This question is occur in interview. Please help me.

Twelve:

"At least 12."

So yeah, 12 is safe everything above that is implementation defined.
Actually it is implementation defined anyway. Just because the standard
says 12 it does not mean there are 12. Some common architectures may not
support it.
>I wonder if anybody ever made a non toy program with 12 levels of pointers.
There will always be at least one. The world is a nanny state in many
places and it has perverted the rule of Darwin. :-)

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys.org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Jun 9 '07 #35

P: n/a
Malcolm McLean wrote, On 09/06/07 08:49:
>
"Charlton Wilbur" <cw*****@chromatico.netwrote in message
news:87************@mithril.chromatico.net...
>>>>>>"MML" == Malcolm McLean <re*******@btinternet.comwrites:

MMLHowever remember that the interviewer isn't really interested
MMLin technical ability - he knows that from your CV -

Er, you haven't seen some of the resumes I've seen, then, and
subsequently interviewed the candidates with the same name at the top
of the resume. The technical ability described on the resume may have
nothing at all to do with the technical ability possessed by the
candidate, and it is an irresponsible interviewer who does not
evaluate the candidate in front of him separately from what the resume
claims.
Maybe that says more about the interview process than the candidate.
That is particularly true of computers. Put someone in front of an
unfamiliar system and he won't even know how to log on. That doesn't
mean that within a few days he won't be perfectly competent and productive.

Questions like "how many levels of indirection does C allow?" tell you a
little bit, but not much. Some programmers don't even use the term
"indirection", though they know what the concept means. An experienced
programmer might say "I don't know", because it is just a bit of trivia
of no real interest to anyone not actually implementing a compiler.
It is not a question I would ask, but I would never just answer "I don't
know."
If people are coming to you claiming two years' experience as a C
Actually *having* X years experience does not mean that someone is any good.
programmer developing desktop apps with Blogg's corps, or possessing a
degree in computer studies, and seemingly now knowing basic things, then
you really need to look at what is going on.
Whatever the candidate you need to evaluate whether they have the
ability to do the job. This includes their problem solving abilities,
learning abilities, how much they already know about appropriate
subjects and whether they will fit in as a person.
Whilst the candidate is
trying to sell himself and put a good gloss on his achievements,
outright lying is relatively rare, and in Britain at least is illegal.
It has cost the company I work for money. The company I used to work for
has also let someone go within a few months. In some other countries
(no, I won't say which) it seems to be far more common and/or more
extreme based on my real world experience.
It could be that people are elevating trivial exposure to something into
wide experience, but then you might be making the mistake of saying "we
need someone who knows how to log on to Unix".
My experience is that most companies are not making that mistake. I once
failed to get a job because I was "too good" despite 90% of my answers
being of the form, "well, I've not done that sort of thing before but I
would check in this sort of book and approach the problem like this",
and other interviews where the company has had my *real* CV and I've
come close to getting the job despite obviously not having some of what
they wanted.

I am in Britain.
--
Flash Gordon
Jun 9 '07 #36

P: n/a
"Chris Hills" <ch***@phaedsys.orgschrieb im Newsbeitrag
news:V+**************@phaedsys.demon.co.uk...
In article <f4**********@news1.zwoll1.ov.home.nl>, Kira <as**@n.tkwrites
>>"Kenneth Brody" <ke******@spamcop.netwrote in message
news:46***************@spamcop.net...
>>Ben Pfaff wrote:

madhawi <ma*******@gmail.comwrites:

Subject: How many levels of pointers can you have?

This question is occur in interview. Please help me.

Twelve:

"At least 12."

So yeah, 12 is safe everything above that is implementation defined.

Actually it is implementation defined anyway. Just because the standard
says 12 it does not mean there are 12. Some common architectures may not
support it.
Less then 12? But that wouldn't be a conforming implementation then, would
it?

Bye, Jojo
Jun 9 '07 #37

P: n/a
In article <f4**********@online.de>, Joachim Schmitz
<no*********@schmitz-digital.dewrites
>"Chris Hills" <ch***@phaedsys.orgschrieb im Newsbeitrag
news:V+**************@phaedsys.demon.co.uk...
>In article <f4**********@news1.zwoll1.ov.home.nl>, Kira <as**@n.tkwrites
>>>"Kenneth Brody" <ke******@spamcop.netwrote in message
news:46***************@spamcop.net...
Ben Pfaff wrote:
>
madhawi <ma*******@gmail.comwrites:
>
Subject: How many levels of pointers can you have?

This question is occur in interview. Please help me.
>
Twelve:

"At least 12."

So yeah, 12 is safe everything above that is implementation defined.

Actually it is implementation defined anyway. Just because the standard
says 12 it does not mean there are 12. Some common architectures may not
support it.
Less then 12? But that wouldn't be a conforming implementation then, would
it?
Bye, Jojo
That is what I said.
95% of the C compilers aren't fully C99 conforming anyway.

AFAIK there are only about 6 compilers in the world that are fully C99
conforming. The other 100 odd are not to a greater or lesser extent.

The practical and realistic answer is to the question it that it is
implementation dependant but that the standard says 12.

Unless and until there is a legal requirement to use a fully conforming
C compiler (to the latest ISO C standard) you with find that the ISO C
standard is a theoretical standard for compilers to aspire to but that
few actually conform to.

So you can give a theoretically accurate answer that is practically
speaking pointless.

I have never seen any "C" compiler advertised as "C-Like" or "nearly
conforming" They are just C-compilers. You have to read the docs to
check the actual spec.
--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys.org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Jun 9 '07 #38

P: n/a
Chris Hills wrote:
In article <f4**********@news1.zwoll1.ov.home.nl>, Kira <as**@n.tk>
writes
>>"Kenneth Brody" <ke******@spamcop.netwrote in message
news:46***************@spamcop.net...
>>Ben Pfaff wrote:

madhawi <ma*******@gmail.comwrites:

Subject: How many levels of pointers can you have?

This question is occur in interview. Please help me.

Twelve:

"At least 12."

So yeah, 12 is safe everything above that is implementation defined.

Actually it is implementation defined anyway. Just because the standard
says 12 it does not mean there are 12.
If there are not, the implementation isn't conformant. Nothing stops
you from using a non-conforming system, just as nothing stops you
from using Fortran or Spitbol; it's just not a conforming C
implementation. That's OK as long as its not advertised as
conforming and as long as you don't expect to port conforming
code to it.
Some common architectures may not support it.
I'm not sure what this "it" is. What do you mean here by "architecture"?
The compiler design? Sure, I can imagine writing a compiler that
wilfully limited how many levels of pointer I could have in a
declaration; but I can also imagine eating wallpaper or swimming
in vinegar.

--
Chips! Hedgehog
Notmuchhere: http://www.electrichedgehog.net/

Jun 9 '07 #39

P: n/a
"Chris Hills" <ch***@phaedsys.orgschrieb im Newsbeitrag
news:Wv**************@phaedsys.demon.co.uk...
In article <f4**********@online.de>, Joachim Schmitz
<no*********@schmitz-digital.dewrites
>>"Chris Hills" <ch***@phaedsys.orgschrieb im Newsbeitrag
news:V+**************@phaedsys.demon.co.uk...
>>In article <f4**********@news1.zwoll1.ov.home.nl>, Kira <as**@n.tk>
writes
"Kenneth Brody" <ke******@spamcop.netwrote in message
news:46***************@spamcop.net...
Ben Pfaff wrote:
>>
>madhawi <ma*******@gmail.comwrites:
>>
Subject: How many levels of pointers can you have?
>
This question is occur in interview. Please help me.
>>
>Twelve:
>
"At least 12."

So yeah, 12 is safe everything above that is implementation defined.

Actually it is implementation defined anyway. Just because the standard
says 12 it does not mean there are 12. Some common architectures may not
support it.
Less then 12? But that wouldn't be a conforming implementation then, would
it?
Bye, Jojo

That is what I said.
95% of the C compilers aren't fully C99 conforming anyway.
So what does C89 require as the minmum?

Bye, Jojo
Jun 9 '07 #40

P: n/a
In article <d9****************@newsb.telia.net>,
Johan Bengtsson <qw*******@hotmail.comwrote:
>Ooops, do you say that there might be a compiler dependent limits to the
number of a->b->c... levels i might use in a statement? I am probably
not using 12 or more, but probably not that far off at some places...
The "12" came from the minimum limit on * in a declaration such as

int ***a;

The case of a->b->c->... is a separate question of expression complexity.

Incidentally, if we have

int ************a; /* 12 stars */

then &a has a type with 13 levels of indirection, so an implementation
has to be able to support the type of

int *************a; /* 13 stars */

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Jun 9 '07 #41

P: n/a
Richard Tobin wrote:
The "12" came from the minimum limit on * in a declaration such as

int ***a;

The case of a->b->c->... is a separate question of expression complexity.
Ahh, thought so, thanks
Jun 9 '07 #42

P: n/a
In article <WV*******************@fe2.news.blueyonder.co.uk >, Chris
Dollin <eh@electrichedgehog.netwrites
>Chris Hills wrote:
>In article <f4**********@news1.zwoll1.ov.home.nl>, Kira <as**@n.tk>
writes
>>>"Kenneth Brody" <ke******@spamcop.netwrote in message
news:46***************@spamcop.net...
Ben Pfaff wrote:
>
madhawi <ma*******@gmail.comwrites:
>
Subject: How many levels of pointers can you have?

This question is occur in interview. Please help me.
>
Twelve:

"At least 12."

So yeah, 12 is safe everything above that is implementation defined.

Actually it is implementation defined anyway. Just because the standard
says 12 it does not mean there are 12.

If there are not, the implementation isn't conformant. Nothing stops
you from using a non-conforming system,
That's good as none of them (bar a few) are fully conforming. In most
fields of C programming there are no C compilers.
>just as nothing stops you
from using Fortran or Spitbol; it's just not a conforming C
implementation. That's OK as long as its not advertised as
conforming and as long as you don't expect to port conforming
code to it.
They are just advertised as "C compilers" not ISO 989:1999 conforming C
compilers.

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys.org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Jun 9 '07 #43

P: n/a
In article <f4**********@online.de>, Joachim Schmitz
<no*********@schmitz-digital.dewrites
>"Chris Hills" <ch***@phaedsys.orgschrieb im Newsbeitrag
news:Wv**************@phaedsys.demon.co.uk...
>In article <f4**********@online.de>, Joachim Schmitz
<no*********@schmitz-digital.dewrites
>>>"Chris Hills" <ch***@phaedsys.orgschrieb im Newsbeitrag
news:V+**************@phaedsys.demon.co.uk...
In article <f4**********@news1.zwoll1.ov.home.nl>, Kira <as**@n.tk>
writes
>"Kenneth Brody" <ke******@spamcop.netwrote in message
>news:46***************@spamcop.net...
>Ben Pfaff wrote:
>>>
>>madhawi <ma*******@gmail.comwrites:
>>>
>Subject: How many levels of pointers can you have?
>>
>This question is occur in interview. Please help me.
>>>
>>Twelve:
>>
>"At least 12."
>
>So yeah, 12 is safe everything above that is implementation defined.

Actually it is implementation defined anyway. Just because the standard
says 12 it does not mean there are 12. Some common architectures may not
support it.
Less then 12? But that wouldn't be a conforming implementation then, would
it?
Bye, Jojo

That is what I said.
95% of the C compilers aren't fully C99 conforming anyway.
So what does C89 require as the minmum?

Bye, Jojo
That's irrelevant the C standard is ISO 9899:1999 all other ISO C
standards are technically obsolete.

There is no ISO C 1989.
--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys.org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Jun 9 '07 #44

P: n/a
"Chris Hills" <ch***@phaedsys.orgschrieb im Newsbeitrag
news:PI**************@phaedsys.demon.co.uk...
In article <f4**********@online.de>, Joachim Schmitz
<no*********@schmitz-digital.dewrites
>>"Chris Hills" <ch***@phaedsys.orgschrieb im Newsbeitrag
news:Wv**************@phaedsys.demon.co.uk...
>>In article <f4**********@online.de>, Joachim Schmitz
<no*********@schmitz-digital.dewrites
"Chris Hills" <ch***@phaedsys.orgschrieb im Newsbeitrag
news:V+**************@phaedsys.demon.co.uk.. .
In article <f4**********@news1.zwoll1.ov.home.nl>, Kira <as**@n.tk>
writes
>>"Kenneth Brody" <ke******@spamcop.netwrote in message
>>news:46***************@spamcop.net...
>>Ben Pfaff wrote:
>>>>
>>>madhawi <ma*******@gmail.comwrites:
>>>>
>>Subject: How many levels of pointers can you have?
>>>
>>This question is occur in interview. Please help me.
>>>>
>>>Twelve:
>>>
>>"At least 12."
>>
>>So yeah, 12 is safe everything above that is implementation defined.
>
Actually it is implementation defined anyway. Just because the
standard
says 12 it does not mean there are 12. Some common architectures may
not
support it.
Less then 12? But that wouldn't be a conforming implementation then,
would
it?
Bye, Jojo

That is what I said.
95% of the C compilers aren't fully C99 conforming anyway.
So what does C89 require as the minmum?

Bye, Jojo

That's irrelevant the C standard is ISO 9899:1999 all other ISO C
standards are technically obsolete.

There is no ISO C 1989.
I doubt that, but anyway: what did ISO C 1989 require back than?

Bye, Jojo
Jun 9 '07 #45

P: n/a
Joachim Schmitz wrote:
"Chris Hills" <ch***@phaedsys.orgschrieb im Newsbeitrag
>In article <f4**********@online.de>, Joachim Schmitz
.... snip ...
>>
That's irrelevant the C standard is ISO 9899:1999 all other ISO
C standards are technically obsolete.

There is no ISO C 1989.

I doubt that, but anyway: what did ISO C 1989 require back than?
Chris is being somewhat doltish here. There never was an ISO C89
because that version was an ANSI standard. ISO took it over, did
some paragraph renumbering, and issued it otherwise unchanged as
C90.

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
<http://kadaitcha.cx/vista/dogsbreakfast/index.html>
cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

Jun 9 '07 #46

P: n/a
"Joachim Schmitz" <no*********@schmitz-digital.dewrites:
"Chris Hills" <ch***@phaedsys.orgschrieb im Newsbeitrag
news:Wv**************@phaedsys.demon.co.uk...
>In article <f4**********@online.de>, Joachim Schmitz
<no*********@schmitz-digital.dewrites
>>>"Chris Hills" <ch***@phaedsys.orgschrieb im Newsbeitrag
news:V+**************@phaedsys.demon.co.uk...
In article <f4**********@news1.zwoll1.ov.home.nl>, Kira <as**@n.tk>
writes
>"Kenneth Brody" <ke******@spamcop.netwrote in message
>news:46***************@spamcop.net...
>Ben Pfaff wrote:
>>>
>>madhawi <ma*******@gmail.comwrites:
>>>
>Subject: How many levels of pointers can you have?
>>
>This question is occur in interview. Please help me.
>>>
>>Twelve:
>>
>"At least 12."
>
>So yeah, 12 is safe everything above that is implementation defined.

Actually it is implementation defined anyway. Just because the standard
says 12 it does not mean there are 12. Some common architectures may not
support it.
Less then 12? But that wouldn't be a conforming implementation then, would
it?

That is what I said.
95% of the C compilers aren't fully C99 conforming anyway.
So what does C89 require as the minmum?
12.

C90 5.2.4.1:

12 pointer, array, and function declarators (in any combinations)
modifying an arithmetic, a structure, a union, or an incomplete
type in a declaration

As in C99, an implementation is merely required to translate and
execute a single program that hits all the enumerated limits; there's
no guarantee that it can handle 12 levels in *your* program.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 9 '07 #47

P: n/a
CBFalconer said:
Joachim Schmitz wrote:
>"Chris Hills" <ch***@phaedsys.orgschrieb im Newsbeitrag
>>In article <f4**********@online.de>, Joachim Schmitz
... snip ...
>>>
That's irrelevant the C standard is ISO 9899:1999 all other ISO
C standards are technically obsolete.

There is no ISO C 1989.

I doubt that, but anyway: what did ISO C 1989 require back than?

Chris is being somewhat doltish here.
That's something I never really understood - what is so doltish about
being *right*.
There never was an ISO C89
because that version was an ANSI standard.
So you're agreeing with Chris. Does that mean you're being doltish too?

Come on, Chuck, please don't insult people for being right.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Jun 9 '07 #48

P: n/a
Chris Hills wrote:
That's irrelevant the C standard is ISO 9899:1999 all other ISO C
standards are
technically
Indeed.
obsolete.
There is no ISO C 1989.
Historical revisionism at its finest.

--
Amused Hedgehog
"We did not have time to find out everything we wanted to know."
- James Blish, /A Clash of Cymbals/

Jun 9 '07 #49

P: n/a
Chris Dollin said:
Chris Hills wrote:
>That's irrelevant the C standard is ISO 9899:1999 all other ISO C
standards are
>technically

Indeed.
>obsolete.
>There is no ISO C 1989.

Historical revisionism at its finest.
Read what he said again, more carefully. There is not now, and nor has
there ever been, an ISO C 1989. This is not historical revisionism, but
historical fact.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Jun 9 '07 #50

158 Replies

This discussion thread is closed

Replies have been disabled for this discussion.