🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1019

What is "int &const r"?

#1019
From: Tom Ngo
Date: Tue, 16 Apr 1991 03:37
24 lines
1042 bytes
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?

--
  Tom Ngo
  ngo@harvard.harvard.edu
  617/495-1768 lab number, leave message
Technical Details
Message-ID: <NGO.91Apr15233743@tammy.harvard.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!paperboy!hsdndev!husc6!ngo

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!paperboy!hsdndev!husc6!ngo
From: ngo@tammy.harvard.edu (Tom Ngo)
Newsgroups: comp.std.c++
Subject: What is "int &const r"?
Message-ID: <NGO.91Apr15233743@tammy.harvard.edu>
Date: 16 Apr 91 03:37:43 GMT
Sender: news@husc6.harvard.edu
Distribution: comp
Organization: Harvard Chemistry Department
Lines: 24