🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Undefined versus unspecified

#2860
From: Jerry Coffin
Date: Wed, 06 Dec 1995 01:54
42 lines
2058 bytes
kanze@gabi-soft.fr (J. Kanze) wrote:

[ ... ] 

>I see what you and Steve Clamage are getting at, but strictly speaking,
>from a standards point of view, is there any real difference?  If I
>understand you correctly, unspecified means that it will work, but the
>standard does not define what `work' means in this context.  So if it
>formats my hard disk (to take the classical example), the vendor can
>simply say: it's not a bug, that's our definition of work.

Not really.  Consider a real example of unspecified behavior:

	a = b + c + d;

Now, it is unspecified whether the multiplication will be evaluated
before or after the division.  Under some circumstances, you may even be
able to detect a diference.  (e.g. depending on the magnitudes involved,
floating point accuracy can be affected.)

Now assuming the magnitudes involved are such that no intermediate
result can cause an overflow, then this can't do anything other than
give us a result.  Changes in evaluation order may change the accuracy
of the result, but certainly can't reformat your hard disk.  By
contrast, if we compute `b*c/d' and d is 0, then the result is
undefined, and something terrible may happen.
    Later,
    Jerry.

/* I can barely express my own opinions; I certainly can't
 * express anybody else's.
 *
 * The universe is a figment of its own imagination.
 */



---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <4a2nvl$nq@natasha.rmii.com>
Path: arc1-ca.pugleaf.net!news.mindlink.net!agate!agate!Matt
References: <MATT.95Nov30185128@cyclops5.berkeley.edu> <ACE4F57196681C2631@corf.demon.co.uk> <49uf3e$hpr@gabi.gabi-soft.fr>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!news.mindlink.net!agate!agate!Matt
From: jcoffin@rmii.com (Jerry Coffin)
Newsgroups: comp.std.c++
Subject: Re: Undefined versus unspecified
Date: 06 Dec 1995 01:54:40 GMT
Organization: TAEUS
Approved: Matt@Austern
Message-ID: <4a2nvl$nq@natasha.rmii.com>
References: <MATT.95Nov30185128@cyclops5.berkeley.edu> <ACE4F57196681C2631@corf.demon.co.uk> <49uf3e$hpr@gabi.gabi-soft.fr>
NNTP-Posting-Host: austern.hip.berkeley.edu