From -4817810115702597991
X-Google-Thread: f78e5,affed1ff1aaec0cc
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII
Path: g2news2.google.com!news4.google.com!news.glorb.com!news.alt.net!comp-std-cpp-robomod!not-for-mail
From: kuyper@wizard.net
Newsgroups: comp.std.c++
Subject: Re: return c - c;
Date: Thu, 18 May 2006 00:55:51 CST
Organization: http://groups.google.com
Lines: 38
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <1147873090.546428.318480@j55g2000cwa.googlegroups.com>
References: <ol38g.8911$j7.305122@news.indigo.ie>
   <9pI8g.9044$j7.305259@news.indigo.ie>
   <4467E837.3070908@usq.edu.au>
   <1147689443.069036.37370@i39g2000cwa.googlegroups.com>
   <MPG.1ed2a79f634808e398a532@news.nabs.net>
   <1147752080.707405.193860@v46g2000cwv.googlegroups.com>
   <9P$gtcA52ZaEFwsf@robinton.demon.co.uk>
   <cyoag.9251$j7.305819@news.indigo.ie>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1147873095 32245 127.0.0.1 (17 May 2006 13:38:15 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Wed, 17 May 2006 13:38:15 +0000 (UTC)
Return-Path: <devnull@stump.algebra.com>
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Original-To: std-c++@mailman.ucar.edu
Delivered-To: std-c++@mailman.ucar.edu
Delivered-To: std-c++@ucar.edu
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050920 Firefox/1.0.7,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: j55g2000cwa.googlegroups.com; posting-host=65.242.71.114;
   posting-account=bPBxkgwAAABzUwlEAMy-xGlLqZFJ5Jz_
X-Virus-Scanned: amavisd-new at ucar.edu
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
X-MIME-Autoconverted: from quoted-printable to 8bit by mulga.cs.mu.OZ.AU id k4HDcatF027639
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
Xref: g2news2.google.com comp.std.c++:2045

Tom�s wrote:
> >int main(void)
> >{
> >    unsigned char c;
> >    return c-c;
> >}
>
>
> Given that an unsigned char has no invalid bit patterns, there shouldn't
> be any time, place, system, implementation or platform where this code
> would return anything other than zero.

As Francis Glassborow pointed out, in Sydney a response was given to a
DR which said that not only is the value of 'c' indeterminate, it can
be a different indeterminate value each time it is read. The
implication is that the implementation doesn't have to really reserve
any space for an object until after the first time it's actually
written to. It can use a different temporary piece of memory for each
read. Even if it uses the same memory for both reads, it's allowed to
use that memory for some other purpose between those two reads,
possibly changing its value.

If that's the case, then a non-zero value for c-c is perfectly
feasible; I think it's unlikely but it's certainly possible.

Since he was responding to a message I wrote that talked about both C99
and C++, I'm not sure which committe's meeting he was referring to.
However, the simple fact that either of the two committees issued such
a ruling demonstrates that a value of 0 for c-c should not be
considered a foregone conclusion.


---
[ 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.comeaucomputing.com/csc/faq.html                      ]



