From -8376746542737463313
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,386ad3d115455fbe
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2002-12-05 11:23:09 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: markus.mauhart@nospamm.chello.at ("Markus Mauhart")
Newsgroups: comp.std.c++
Subject: properties of scalar objects w/ indeterminate value //Re: iterator defect or feature?
Date: Thu, 5 Dec 2002 19:23:08 +0000 (UTC)
Organization: Customers chello Austria
Lines: 54
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <rpNH9.6193$A9.108922@news.chello.at>
References: <arn2gt$5jc8$1@cgl.ucsf.edu> <3de29db4.7069828@news.earthlink.net>
X-Trace: mail2news.demon.co.uk 1039116188 7050 10.0.0.1 (5 Dec 2002 19:23:08 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Thu, 5 Dec 2002 19:23:08 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.05)
	id 18K1aU-0001pX-00
	for mail2news@news.news.demon.net; Thu, 05 Dec 2002 19:23:07 +0000
X-Received: from localhost (localhost [[UNIX: localhost]]) by mulga.cs.mu.OZ.AU
	id GAA16280; Fri, 6 Dec 2002 06:22:57 +1100 (EST)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Path: comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Delivered-To: std-c++@ncar.ucar.edu
X-Newsgroups: comp.std.c++
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
X-NNTP-Posting-Date: Thu, 05 Dec 2002 20:02:47 MET
X-Spam-Status: No, hits=-4.5 required=5.0
	tests=INVALID_MSGID,NOSPAM_INC,PRIORITY_NO_NAME,
	      QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_00_01
	version=2.41
Xref: archiver1.google.com comp.std.c++:15707

"John Potter" <jpotter@falcon.lhup.edu> wrote ...
>
> You should never do anything other than assign a new value with a
> default constructed iterator.  It is just like int* p;

AFAICS there are significant differences between iterators
with required def-ctor and 'un-initialized' raw pointers:

iterator i, j           ;//both may be 'singular'
i == i                  ;//undefined behaviour. (OK for pointers ?)
j =  i                  ;//undefined behaviour. OK for pointers
j == i                  ;//undefined behaviour. (OK for pointers ?)
iterator k = iterator() ;//undefined behaviour. OK for pointers
iterator l(i)           ;//undefined behaviour. OK for pointers

AFAICS this kind of well defined "copy/assignment between same types"
applies to all 'un-initialized' ('indeterminate value') scalar types.

What is not clear for me is whether one may compare such things
to certain other things. Naively one might guess that all such
copies of an indeterminate value must compare equal and not !=,
especially not raising an exception or formatting the disk !

That leds me to the question what generally is allowed
for scalar type objects with indeterminate values:

typedef int*_or_double S;
S s    ;//non-static -> indeterminate value.
s == s ;//true or indeterminate result or undefined behaviour ?
S t = s;//8.5,par14: the initial value of the object being initialized
        //is the (possibly converted) value of the initializer expression.
        // => not undefined behaviour; "same value".
t == s ;//true or indeterminate result or undefined behaviour ?
t = s  ;// => not undefined behaviour; "same value".
t == s ;//true or indeterminate result or undefined behaviour ?

Especially w.r.t pointers I'm not sure about comparing:
[expr.eq] 5.10,par1: Two pointers of the same type compare equal if
and only if they are both null, both point to the same object or
function, or both point one past the end of the same array.


Kind regards,
Markus.




---
[ 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    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



