Article View: comp.std.c++
Article #1020Re: What is "int &const r"?
From: Harald Fuchs
Date: Tue, 16 Apr 1991 16:06
Date: Tue, 16 Apr 1991 16:06
28 lines
1413 bytes
1413 bytes
ngo@tammy.harvard.edu (Tom Ngo) writes: >Here's an interesting C++ statement. What does it mean? > int &const r; >Hopefully your answer is that it is illegal and/or meaningless. If >so, look in ARM 8.2.2 [References], which states: > In a declaration T D where D has the form > & cv-qualifier-list-opt D1 > the type of the contained identifier is "... cv-qualifier-list > reference to T." >And, of course, a cv-qualifier can be const or volatile. >What is a const reference??!? Is this an error in the ARM, or have I >totally misunderstood references? "No" to both questions. A reference is always constant, so "int&const r" is just a more verbose alternative to "int& r". Why bother with explicitly disallowing redundancies? See the original Stroustrup bible for details. -- Harald Fuchs <fuchs@t500e0.telematik.informatik.uni-karlsruhe.de>
Technical Details
Message-ID:
<fuchs.671817962@t500e0>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!t500e0!fuchsReferences:
<NGO.91Apr15233743@tammy.harvard.edu>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++ Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!ira.uka.de!t500e0!fuchs From: fuchs@t500e0.telematik.informatik.uni-karlsruhe.de (Harald Fuchs) Subject: Re: What is "int &const r"? Message-ID: <fuchs.671817962@t500e0> Sender: news@ira.uka.de (USENET News System) Organization: University of Karlsruhe, FRG References: <NGO.91Apr15233743@tammy.harvard.edu> Distribution: comp Date: Tue, 16 Apr 1991 16:06:02 GMT Lines: 28