Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
reference collapsing and cv-qualifiers
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
"William M. (Mike) Miller"  
View profile  
 More options Oct 1 2005, 12:42 am
Newsgroups: comp.std.c++
From: w...@world.std.com ("William M. (Mike) Miller")
Date: Sat, 1 Oct 2005 04:42:34 GMT
Local: Sat, Oct 1 2005 12:42 am
Subject: Re: reference collapsing and cv-qualifiers

This issue is now under active discussion on the Standard
Committee's core working group email reflector, and it will be
discussed at next week's Committee meeting.

Personally, I don't see an inconsistency here.  The difference
between your examples is the difference between "...& const" and
"...const &".  Adding a top-level reference to a parameter type
prevents other kinds of type adjustments (e.g., dropping a
top-level const from a parameter type when creating the function
type, array-to-pointer and function-to-pointer decay), so it
seems reasonable (to me, at least) that adding a top-level
reference to a "const int_ref" would also prevent the discarding
of the const qualifier.

Furthermore, it seems reasonable (to me) that a person who
declares a "const T& t" should be able to rely on const semantics
for "t", that you should be able to distinguish overloaded
functions with "T&" and "const T&" parameters, etc., without
having to worry about whether T is a reference type or not.

There are different views represented on the Committee, so I'm
sure we'll have an interesting discussion next week.  It's
already been interesting on the core reflector.

> I don't see why it needs to be this way. It'd be better if DR-106 were
> either scaled back so cv-qualifiers on references were consistently
> ignored throughout the language, or broadened so they could be
> consistently applied.

Again, from my perspective, cv-qualifiers on references _are_
consistently ignored throughout the language; according to the
issue 106 resolution, "const int_ref&" is a reference to a
cv-qualified type, not a cv-qualified reference.

We will be discussing the other alternative you mentioned,
namely, not ignoring cv-qualification on top-level reference
types.  We have something of a parallel situation already in the
language with the way cv-qualified array types qualify the
element type as well, so something like that might be reasonable
for reference types, too.  However, that kind of change clearly
would break some code, although it's not clear how much, and no
one has done much analysis yet on how such a change might be
defined nor on its impact.

> I wonder if the author/authors of this
> proposal were aware of 8.3.2p1 and how it conflicts (conceptually) with
> the behavior they specify for reference collapsing.

Aware of 8.3.2p1, yes; viewing it as a conflict, no.  8.3.2p1
deals with cv-qualification of top-level references, which is not
what happens in the issue 106 resolution.

--
William M. (Mike) Miller | Edison Design Group, Inc.
w...@world.std.com

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-...@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Russell Yanofsky  
View profile  
 More options Oct 1 2005, 2:01 pm
Newsgroups: comp.std.c++
From: "Russell Yanofsky" <russell.yanof...@us.army.mil>
Date: Sat, 1 Oct 2005 12:01:55 CST
Local: Sat, Oct 1 2005 2:01 pm
Subject: Re: reference collapsing and cv-qualifiers

"William M. MikeMiller" wrote:
> This issue is now under active discussion on the Standard
> Committee's core working group email reflector, and it will be
> discussed at next week's Committee meeting.

Glad to hear it's being discussed. I don't know what an "email
reflector" is, but I'd be interested in reading the discussion if it's
publicly available somewhere.

> Personally, I don't see an inconsistency here.  The difference
> between your examples is the difference between "...& const" and
> "...const &".

No. It's the difference between "& const" and "& const &." Why ignore
the const qualifier in the first case and apply it in the second case
when you can just be simple and consistent and either always ignore it
or always apply it.

The things you say about c++ doing similar type adjustments in other
parts of the language are true. And I understand your more complicated
way of looking at the const like it modifies the second & rather than
the first. But there are good reasons for making those adjustments.
What advantages does the extra complexity offer us in this case?

- Russ

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-...@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Abrahams  
View profile  
 More options Oct 9 2005, 6:00 pm
Newsgroups: comp.std.c++
From: d...@boost-consulting.com (David Abrahams)
Date: Sun, 9 Oct 2005 22:00:36 GMT
Local: Sun, Oct 9 2005 6:00 pm
Subject: Re: reference collapsing and cv-qualifiers

"Russell Yanofsky" <russell.yanof...@us.army.mil> writes:
> "William M. MikeMiller" wrote:
>> This issue is now under active discussion on the Standard
>> Committee's core working group email reflector, and it will be
>> discussed at next week's Committee meeting.

> Glad to hear it's being discussed. I don't know what an "email
> reflector" is,

It's just a mailing list.

> but I'd be interested in reading the discussion if it's publicly
> available somewhere.

Unfortunately, those lists are only accessible to non-committee
members rarely, and by special permission.

>> Personally, I don't see an inconsistency here.  The difference
>> between your examples is the difference between "...& const" and
>> "...const &".

> No. It's the difference between "& const" and "& const &." Why ignore
> the const qualifier in the first case and apply it in the second case
> when you can just be simple and consistent and either always ignore it
> or always apply it.

> The things you say about c++ doing similar type adjustments in other
> parts of the language are true. And I understand your more complicated
> way of looking at the const like it modifies the second & rather than
> the first. But there are good reasons for making those adjustments.
> What advantages does the extra complexity offer us in this case?

FWIW, at Mont Tremblant last week the core language working group
resolved that the outer cv-qualifier and reference should be dropped.
In other words, if T is int&, T const& is also int&.

--
Dave Abrahams
Boost Consulting
www.boost-consulting.com

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-...@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google