What's the meaning of this variable definition?

M

Martin Ambuhl

Klein said:
const S_Table_Structure * const * cur = table;
cur is a pointer to
a const pointer to
a const S_Table_Structure
initialized to table
 
P

Philip Paeps

Klein said:
const S_Table_Structure * const * cur = table;

You might be interested in the 'cdecl' tool (google for source), which can
help you easily detangle the most complex declarations...

- Philip
 
C

CBFalconer

Klein said:
const S_Table_Structure * const * cur = table;

Ask your question in the article - the subject is not always
available to the reader.

According to cdecl, after replacing the result of a typedef in the
original statement, the result is:

cdecl> explain const struct y * const * x
declare x as pointer to const pointer to const struct y

Your statement also initializes x with the value table. The only
thing that is writable in the thing is the pointer x (or cur in
your case) itself.

This is the only real reason I have seen to avoid the use of
typedef in structs. It seems that cdecl cannot handle two
undefined entities in the same query.
 

Ask a Question

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.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top