🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

4 total messages Started by john (j.d.) hickin Fri, 12 Apr 1996 16:26
Interpretation Sought for DWP Concept of 'Valid Object'
#4012
Author: john (j.d.) hickin
Date: Fri, 12 Apr 1996 16:26
21 lines
1776 bytes
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.

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?

-- 
John Hickin      Nortel Technology, Montreal, Quebec
(514) 765-7924   hickin@nortel.ca
---
[ 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 
]
Re: Interpretation Sought for DWP Concept of 'Valid Object'
#4017
Author: 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 
]
Re: Interpretation Sought for DWP Concept of 'Valid Object'
#4035
Author: David Vandevoorde
Date: Mon, 15 Apr 1996 02:47
35 lines
2145 bytes
>>>>> "JH" == "john (j d ) hickin" <hickin@bnr.ca> writes:
[...]
JH> A recent thread in another newsgroup has aroused some interest.
JH> Lately there has been a small debate around the interpretation of
JH> the following phrase, ostensibly taken from the DWP:

JH> 	A reference shall be initialized to refer to a valid object or
JH>     function.

I checked and could find no such wording. Instead, I found:

  [dcl.init.ref] 8.5.3/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.

JH> One party claims that valid object means initialized object while
JH> another claims that all is required is that the object have a
JH> valid address.

JH> Does the DWP make it clear which interpretation should be used?

I'm not at all sure that the DWP uses the phrase `valid object' at
all. If it did, I would expect it to mean `an object whose lifetime
has begun and not expired'; the lifetime of an object is defined in
[basic.life].

	Daveed


[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
Re: Interpretation Sought for DWP Concept of 'Valid Object'
#4073
Author: John E. Potter
Date: Wed, 17 Apr 1996 13:14
48 lines
2525 bytes
David Vandevoorde (vandevod@cs.rpi.edu) wrote:
: >>>>> "JH" == "john (j d ) hickin" <hickin@bnr.ca> writes:
: [...]
: JH> A recent thread in another newsgroup has aroused some interest.
: JH> Lately there has been a small debate around the interpretation of
: JH> the following phrase, ostensibly taken from the DWP:

: JH> 	A reference shall be initialized to refer to a valid object or
: JH>     function.

: I checked and could find no such wording. Instead, I found:

:   [dcl.init.ref] 8.5.3/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.

: JH> One party claims that valid object means initialized object while
: JH> another claims that all is required is that the object have a
: JH> valid address.

: JH> Does the DWP make it clear which interpretation should be used?

: I'm not at all sure that the DWP uses the phrase `valid object' at
: all. If it did, I would expect it to mean `an object whose lifetime
: has begun and not expired'; the lifetime of an object is defined in
: [basic.life].

From April public draft.

8.3.2 [dcl.ref] /4

"A reference shall be initialized to refer to a valid object or
												^^^^^
function.  In particular, null references are prohibited; ..."

IMHO it is a verbose lead-in to the next sentence which really says
something.

John
---
[ comp.std.c++ is moderated.  To submit articles: try just posting with      ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu         ]
[ FAQ:      http://reality.sgi.com/employees/austern_mti/std-c++/faq.html    ]
[ Policy:   http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu                             ]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads