Liste des Groupes | Revenir à cl c |
Bart <bc@freeuk.com> writes:On 28/11/2024 22:38, Keith Thompson wrote:
It's to illustrate that the constness of a variable may depend on something which is remote from its declaration.Yes, you said that T is an alias for 'const int'. Not sure why you>T x; // defines a readonly variable (which probably needsYou say T is an alias (what, a macro?) for 'const int', you show code
// initialising)
T* y; // defines a variable pointer
>
'const' is out of the picture.
using T, and then you say "'const' is out of the picture". If you
have a point, it escapes me.
Well, can you see 'const' in my example? You can't tell x is readonly
by only looking at this.
wrote "alias". Is it a macro, or a typedef, or something else?
I suggest that hiding "const" behind a macro or typedef is usually a bad
idea. Why did you do it here? Is your example based on real code, or
did you contrive it to be as confusing as possible?
Les messages affichés proviennent d'usenet.