const does not apply to pointers?

M

mlimber

mlimber said:
Precisely what I do in my real code. I was simplifying here so as not
to obscure the main issue.

However, your point is well-taken, and I probably shouldn't have
bothered simplifying that part.

Cheers! --M
 
E

Earl Purple

mlimber said:
It is necessary.

Yes it is necessary that assignment cannot take place but not necessary
to explicitly disable it as the preference of a const member will
automatically do that for you.
 
N

Noah Roberts

Ron said:
Once you get past a trivial declaration you're not going
to be able to linearly translate into something lexically
symentric. I say:
const char STAR foo
If I'm reading the code, but if I'm describing the
type I say
pointer to const char.

Trying to say something like

int *(*foo)(const char*, int(*)());

is just going to be gibberish read left to right.

Yeah, well do whatever you want. I find code more readable when it
reads clearly. I leave obscurity to those rare places where it's
needed. This also means I like sticking to "trivial" declarations
almost all the time.
 
M

mlimber

Earl said:
Yes it is necessary that assignment cannot take place but not necessary
to explicitly disable it as the preference of a const member will
automatically do that for you.

Right you are. At least one of my compiler complains, however, if I
don't explicitly disable it.

Cheers! --M
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top