Qualification Conversion

N

Neelesh Bodas

I think I understand this, but want to confirm. Is the following
statement correct? ("yes" acc. to my understanding)

<quote>
A qualification conversion talks about pointer types, not about non-
pointer types. Specifically, "T* to const T*" is a qualification
conversion, but "T to const T" or "const T to T" is not, for some non-
pointer type T.
</quote>

-Neelesh
 
A

Alf P. Steinbach

* Neelesh Bodas:
I think I understand this, but want to confirm. Is the following
statement correct? ("yes" acc. to my understanding)

<quote>
A qualification conversion talks about pointer types, not about non-
pointer types. Specifically, "T* to const T*" is a qualification
conversion, but "T to const T" or "const T to T" is not, for some non-
pointer type T.
</quote>

Whoever it was forgot about reference types.
 
N

Neelesh Bodas

Whoever it was forgot about reference types.

But section 4.4 of The C++ standard talks about qualification
conversions and it doesnt mention anything about references. Rather,
it talks completely about pointer types. (at least thats what I
interpreted)
 
A

Alf P. Steinbach

* Neelesh Bodas:
But section 4.4 of The C++ standard talks about qualification
conversions and it doesnt mention anything about references. Rather,
it talks completely about pointer types. (at least thats what I
interpreted)

Ah, well. The current standard's §4.4 does indeed define "qualification
conversion" as cv-qualification conversion of pointers, only. And that
is relevant and important in §13.3.3.2's rules for ranking candidate
functions for overload resolution, where T& -> T cv& is treated as a
special case not covered by the standard conversions.

With the standard's terminology one needs to say "qualification
adjustment" wrt. references, because references are not values and as
such cannot be "converted".

One problem with trying to steer that course is that in some cases the
apparent fine distinctions in the standard do matter (in this case, for
overload resolution), and in other cases they don't really matter and
one is led completely astray by thinking they do matter. In particular,
people get into very hot discussions about imprecise context-sensitive
terms like "call", which they think there must be some narrow
not-ordinary definition for somewhere in the standard (there isn't, but
when that is pointed out, discussion typically proceeds by arguments
that such is implied but the authors of the standard forgot to include
it...). Instead of knowing every little sentence of the standard by
heart, necessary in order to adopt its terminology for everything, it's
much more practical to always refer explicitly to the standard whenever
one really means some narrow definition found in the standard.
 

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,291
Messages
2,571,453
Members
48,137
Latest member
IndiraMcCo

Latest Threads

Top