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

What's the meaning of this variable definition?

P: n/a
const S_Table_Structure * const * cur = table;

Nov 14 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Klein wrote:
const S_Table_Structure * const * cur = table;

cur is a pointer to
a const pointer to
a const S_Table_Structure
initialized to table

Nov 14 '05 #2

P: n/a
Klein <hu*******@gmail.com> wrote:
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

--
Philip Paeps Please don't email any replies
ph****@paeps.cx I follow the newsgroup.

It's always darkest just before the lights go out.
Nov 14 '05 #3

P: n/a
Klein wrote:

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.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
Nov 14 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.