Re: help with 'left-right' cdecl rule
- From: "Old Wolf" <oldwolf@xxxxxxxxxxxxxx>
- Date: 13 Feb 2006 17:12:16 -0800
jonsmallberries@xxxxxxxxx wrote:
In the FAQ they said to read from inside out. So yeah, this does make
sense foo is a const pointer to int.
This "const int * foo" also makes sense, foo is a pointer to a const
int.
But, "int const * foo" is just lame. I checked just for clarity's sake
to see if this is the same in C++ (it is) and the site had this to say.
It is the "const int * foo" version which is lame.
Reading from insde out, as you suggest:
const int * foo foo is a pointer to an int constant
int const * foo foo is a pointer to a constant int
"Basically 'const' applies to whatever is on its immediate left
other than if there is nothing there in which case it applies to
whatever is its immediate right)." Can we say confusing?
The "int const * foo" version obeys the first part of this rule,
the confusing exception is necessary to cover the case of
"const int * foo" .
.
- Follow-Ups:
- Re: help with 'left-right' cdecl rule
- From: Ben Bacarisse
- Re: help with 'left-right' cdecl rule
- References:
- help with 'left-right' cdecl rule
- From: James Brown [MVP]
- Re: help with 'left-right' cdecl rule
- From: jonsmallberries
- Re: help with 'left-right' cdecl rule
- From: Michael Mair
- Re: help with 'left-right' cdecl rule
- From: jonsmallberries
- help with 'left-right' cdecl rule
- Prev by Date: Re: preprocessor token
- Next by Date: Re: fmod
- Previous by thread: Re: help with 'left-right' cdecl rule
- Next by thread: Re: help with 'left-right' cdecl rule
- Index(es):
Relevant Pages
|