Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
11.3: How many 'levels' deep?
#2
I'm not sure I've understood the "cv" notation that you've used so I'll use a more verbose description in my reply.

For what it's worth, my interpretation of Rule 11.3 is that it's permitted to convert "pointer to Q1 T" into "pointer to Q2 T" where T is some type and Q1 and Q2 are sets, possibly empty, of type qualifiers. T must be the same type in both cases but Q1 and Q2 may be different. This means that it is permitted to "cast away" a const or volatile qualifier according to Rule 11.3. Protection from the undefined behaviour that might arise in such cases it provided by Rule 11.8 instead.

Rule 11.3 does not permit conversion of "pointer to Q1 T1" into "pointer to Q2 T2" where T1 and T2 are different types, regardless of whether Q1 and Q2 are the same sets of qualifiers. So if T1 is "pointer to const int" and T2 is "pointer to int" then the conversion is prohibited by 11.3.

Therefore I think the answer to the question "How many 'levels' deep?" is "one" though I guess it depends on where you start counting.
<t></t>


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)