🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Interpretation Sought for DWP Concept of 'Valid Object'

#4017
From: Fergus Henderson
Date: Fri, 12 Apr 1996 19:12
44 lines
2632 bytes
"john (j.d.) hickin" <hickin@bnr.ca> writes:

>A recent thread in another newsgroup has aroused some interest.  Lately there
>has been a small debate around the interpretation of the following phrase,
>ostensibly taken from the DWP:
>
>	A reference shall be initialized to refer to a valid object or function.

The January 96 WP doesn't contain those words, or at least I couldn't spot
them.  It says instead

|   8.5.3  References                                       [dcl.init.ref]
| 
| 1 A  variable  declared  to  be  a  T&,  that  is  "reference to type T"
|   (_dcl.ref_), shall be initialized by an object, or function, of type T
|   or by an object that can be converted into a T.  [Example:
|           int g(int);
|           void f()
|           {
|               int i;
|               int& r = i;  // `r' refers to `i'

This is straight out of ARM 8.4.3 (the only change is that "must" has
been replaced with "shall"), so it hasn't changed for a long time.

>One party claims that valid object means initialized object while another
>claims that all is required is that the object have a valid address.
>
>Does the DWP make it clear which interpretation should be used?

Yes: the latter interpretation is correct.  It is OK to initialize
a reference to refer to an uninitialized object, as in the example above.

--
Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]
Technical Details
Message-ID: <4km9i2$hsm@mulga.cs.mu.OZ.AU>
Path: arc1-ca.pugleaf.net!fido.asd.sgi.com!austern
References: <4kltuk$73j@bmtlh10.bnr.ca>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!fido.asd.sgi.com!austern
From: fjh@mundook.cs.mu.OZ.AU (Fergus Henderson)
Newsgroups: comp.std.c++
Subject: Re: Interpretation Sought for DWP Concept of 'Valid Object'
Date: 12 Apr 1996 12:12:50 PDT
Organization: Comp Sci, University of Melbourne
Approved: austern@isolde.mti.sgi.com
Message-ID: <4km9i2$hsm@mulga.cs.mu.OZ.AU>
References: <4kltuk$73j@bmtlh10.bnr.ca>
NNTP-Posting-Host: isolde.mti.sgi.com
X-Original-Date: 12 Apr 1996 19:05:38 GMT
X-Auth: PGPMoose V1.1 PGP comp.std.c++
 iQBVAwUBMW6rNEy4NqrwXLNJAQHESgIAnJNA4PSZA3ch7bvd4g+qlQFKzyXuia4f
 gHDGfmNkfNetX4SjWYA7KIW7qrzEq1KOZlUDpdClpTovMPVtRt9eog==
 =pdHG
Originator: austern@isolde.mti.sgi.com