Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C Programming (http://www.velocityreviews.com/forums/f42-c-programming.html)
-   -   What's the meaning of this variable definition? (http://www.velocityreviews.com/forums/t438206-whats-the-meaning-of-this-variable-definition.html)

Klein 06-01-2005 08:06 AM

What's the meaning of this variable definition?
 
const S_Table_Structure * const * cur = table;


Martin Ambuhl 06-01-2005 08:48 AM

Re: What's the meaning of this variable definition?
 
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


Philip Paeps 06-01-2005 09:07 AM

Re: What's the meaning of this variable definition?
 
Klein <hubo.obuh@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
philip@paeps.cx I follow the newsgroup.

It's always darkest just before the lights go out.

CBFalconer 06-01-2005 10:18 AM

Re: What's the meaning of this variable definition?
 
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




All times are GMT. The time now is 09:59 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57