🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: const reference

#419
From: Ron Guilmette
Date: Sat, 25 Aug 1990 02:49
41 lines
1798 bytes
In article <6285@darkstar.ucsc.edu> daniel@cis.ucsc.edu (Daniel Edelson) writes:
>Is there a concensus on what a const reference means?

I assume you mean a reference which is itself const.

If so, the answer is yes.  The following two are the same:

	extern int & const xx;
	extern int &       yy;

There's no semantic difference.

>A volatile ref. makes as much sense as a volatile pointer,

Not exactly true.  The volatility of a pointer object becomes significant
whenever that pointer object itself is written.  This may occur often during
the lifetime of the pointer object.  A reference object is however only
written once (i.e. during its initialization).  Thus, volatile references,
while having some semantic differences from non-volatile references, are
not very useful.

>but a const reference seems redundant.

Quite.

>Is their either
>agreement or active debate on whether this should be allowed
>or if it has non-null semantic content?

I haven't seen any debate so I assume that indicates agreement that const
refs should be allowed.  Perhaps a warning like:

	CAUTION: silly programming ahead

should be suggested by the final standard.  The semantic content does seem to
be zero.
-- 

// Ron Guilmette  -  C++ Entomologist
// Internet: rfg@ncd.com      uucp: ...uunet!lupine!rfg
// Motto:  If it sticks, force it.  If it breaks, it needed replacing anyway.
Technical Details
Message-ID: <1324@lupine.NCD.COM>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!lupine!rfg
References: <6285@darkstar.ucsc.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!lupine!rfg
From: rfg@NCD.COM (Ron Guilmette)
Newsgroups: comp.std.c++
Subject: Re: const reference
Keywords: Trying to pick a fight
Message-ID: <1324@lupine.NCD.COM>
Date: 25 Aug 90 02:49:35 GMT
References: <6285@darkstar.ucsc.edu>
Organization: Network Computing Devices, Inc., Mt. View, CA
Lines: 41