Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > What's the meaning of this variable definition?

Reply
Thread Tools

What's the meaning of this variable definition?

 
 
Klein
Guest
Posts: n/a
 
      06-01-2005
const S_Table_Structure * const * cur = table;

 
Reply With Quote
 
 
 
 
Martin Ambuhl
Guest
Posts: n/a
 
      06-01-2005
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

 
Reply With Quote
 
 
 
 
Philip Paeps
Guest
Posts: n/a
 
      06-01-2005
Klein <(E-Mail Removed)> 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
http://www.velocityreviews.com/forums/(E-Mail Removed) I follow the newsgroup.

It's always darkest just before the lights go out.
 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      06-01-2005
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the meaning of the class variable fl C++ 5 11-19-2010 03:47 PM
Understanding search queries, semantics, and "Meaning" ...aren't weall looking for meaning? 5lvqbwl02@sneakemail.com Python 4 01-14-2009 02:28 PM
"Variable variable name" or "variable lvalue" mfglinux Python 11 09-12-2007 03:08 AM
How do I scope a variable if the variable name contains a variable? David Filmer Perl Misc 19 05-21-2004 03:55 PM
Meaning of output value? Sander Odekerken VHDL 2 05-18-2004 05:41 PM



Advertisments