From 1345141335880788568
X-Google-Thread: f78e5,2e0dbc7156d5459
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII
Path: g2news1.google.com!news2.google.com!proxad.net!proxad.net!194.159.246.34.MISMATCH!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: radekg@b-runner.nospam.org (Radoslaw Grzanka)
Newsgroups: comp.std.c++
Subject: Re: "Undefined Behaviour" or "Non-portable"
Date: Thu,  5 Aug 2004 18:03:24 GMT
Organization: tp.internet - http://www.tpi.pl/
Lines: 48
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <pan.2004.08.04.20.31.50.760348@b-runner.nospam.org>
References: <UpaQc.24396$Z14.7386@news.indigo.ie>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-2
Content-Transfer-Encoding: quoted-printable
X-Trace: news.demon.co.uk 1091729010 2854 158.152.254.254 (5 Aug 2004 18:03:30 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Thu, 5 Aug 2004 18:03:30 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Pan/0.14.2.91 (As She Crawled Across the Table (Debian GNU/Linux))
X-MIME-Autoconverted: from 8bit to quoted-printable by mulga.cs.mu.OZ.AU id i75I3Pjp024940
X-Spam-Checker-Version: SpamAssassin 2.60-mulga_r1 (1.212-2003-09-23-exp) on 
	mulga.cs.mu.OZ.AU
X-Spam-Status: No, hits=-4.9 required=5.2 tests=BAYES_00 autolearn=ham 
	version=2.60-mulga_r1
X-Virus-Scanned: by amavisd-new at TP Internet
X-Path: comp-std-cpp-robomod!not-for-mail
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id i75I3OwF024925;
	Fri, 6 Aug 2004 04:03:24 +1000 (EST)
X-NNTP-Posting-Date: Wed, 4 Aug 2004 20:34:59 +0000 (UTC)
X-Spam-Level: 
X-Delivered-To: std-c++@ucar.edu
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Newsgroups: comp.std.c++
Xref: g2news1.google.com comp.std.c++:1549

Dnia Wed, 04 Aug 2004 20:19:03 +0000, JKop napisa=B3(a):

> Would you classify the following code as "Undefined Behaviour" or as "N=
on-
> portable"?
>=20
> signed main()
> {
>     	signed char chedder =3D 130;
> }
>=20
>=20
> Relevant information:
>=20
> 1) Minimum range for a signed char: -127 to 127
> 2) Overflow for a signed integral type is Undefined Behaviour
> 3) There's no maximum range for a signed char
>=20
> If the program is run on a system with a 9-Bit char, then there's no=20
> overflow, and as such there's no Undefined Behaviour.
>=20
> But overall would you classify it as "Undefined Behaviour" or "Non-
> portable"?

If 2) is right (I didn't remember about that) I would say both. It is
non-portable from machines with more than 8 bits per char and undefined
behaviour on machines with 8 bits and less per char.

Radoslaw.

--=20
"Oceniaj=B1 mnie, cho=E6 nic o mnie nie wiedz=B1. To dlatego jestem sam" =
- Shrek
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D
e-mail: sad[na]rpg[kropka]pl    JID: radekg[na]jabber[kropka]atman[kropka=
]pl
L:C++ E+++ T-- !R P+++ D G++ F:ADoM RL--- !RLA W:CP Q++ AI++ RN+ Hp- Re++=
 S+

---
[ 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                       ]



