Syntax of const pointer reference.

Ignoring the issue that is surely a bad program design.  I need to return a reference to a constant pointer.  The syntax

const Obj * &

is wrong, it means that the thing pointed to is constant.  I believe that what I want is

Obj * const &

Is that correct?  Also can I do this with a non-pointer. Like does

int const & 

mean the same as

const int &
LVL 22
nietodAsked:
Who is Participating?
 
alexoConnect With a Mentor Commented:
I thought that taking your points for this question would be unfair but if you insist...
0
 
alexoCommented:
Yes and Yes.
R U sure you want to waste points on that?
0
 
alexoCommented:
const binds to the left except when it's the first token.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
VEngineerCommented:

Are you trying to do a reference return?  Or is this a parameter being passed?

0
 
alexoCommented:
That is, the thing to the left of the const is constant (unless the const is the first token of the declaration, then the thing to the right of the const is constant).

Beware geeks bearing GIFs!
0
 
nietodAuthor Commented:
>> the thing to the left of the const is constant (unless the const is the first
>> token of the declaration, then the thing to the right of the const is constant)

This language is a mess!  The only thing worse than writting in it would be writting a compiler for it!

Why don't you answer, Alex?

0
 
sgantaCommented:
char *y="testing";
0
 
nietodAuthor Commented:
Was that meant for a different question?  It seems to have nothing to do with my question.  Besides my question was answered and I invited Alexo to submit an answer.
0
 
nietodAuthor Commented:
Now do I let this sit around and be Autograded?????  I guess not.
0
 
alexoCommented:
>> Now do I let this sit around and be Autograded?????
Hell, why not?  I already got Roger "subtly suggesting" all over the place that customers reject my answers and Andrewyu shouting "thank you!" and gracing my answer with a D...

0
 
nietodAuthor Commented:
Yeah, but you aren't in it for the points.... right?  
0
 
alexoCommented:
Right.  But sometimes the attitudes of some (or the terminal stupidity of others) get to me...
0
All Courses

From novice to tech pro — start learning today.