🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #224

Undefined (was: Fortran90 and Arrays)

#224
From: Jim Giles
Date: Wed, 15 Apr 1992 18:05
38 lines
2670 bytes
In article <id.5JWO.UZ5@ferranti.com>, peter@ferranti.com (Peter da Silva) writes:
|> In article <1992Apr14.083505.9432@newshost.lanl.gov> jlg@cochiti.lanl.gov (Jim Giles) writes:
|> > Type punnung is illegal in ANSI C.  Casts of pointers to/from anything
|> > but (void *) is undefined.  Unions (when used for punning) are undefined.
|> 
|> So type punning is *undefined* in ANSI C, not *illegal*. Please be more
|> precise. There are very important differences between illegal, undefined,
|> and implementation-defined. Which do you mean here?

I _am_ being precise.  The word `undefined' is used by the C standard 
for _all_ things which the standard excludes.  The official definition 
is:

   Undefined behavior -- behavior, for a nonportable or erroneous 
   program construct or erroneous data, for which the Standard imposes 
   no requirements.  Permissible undefined behavior ranges from ignoring
   the situation completely with unpredictable results, to behaving 
   during translation or program execution in a documented manner
   characteristic of the environment (with or without the issuance
   of a diagnostic message, or to terminating a translation or 
   execution (with the issuance of a diagnostic message).

This is the _only_ term in the standard document which is defined
to apply to erroneous programs or erroneous data.  As such, it is 
synonymous with the informal term `illegal' in all respects.  The
inclusion of the word `nonportable' in the definition does not 
contradict this: a nonportable feature is one that is beyond the
standard but has been given a meaning by _some_ implementations
(and may be erroneous in others).

Note, the definition allows implementations to produce unpredictable
results (that is, fail silently), fail with a message, or extend
the language to provide a meaning for the feature.  If the program
fails without message the results are permitted by the standard to 
be completely unpredictable: including failing in a different way
for two uses of the same undefined feature in the same program.

J. Giles
Technical Details
Message-ID: <1992Apr15.180551.24861@newshost.lanl.gov>
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!ames!agate!dog.ee.lbl.gov!hellgate.utah.edu!lanl!cochiti.lanl.gov!jlg
References: <STEPHEN.92Apr11201347@estragon.uchicago.edu> <id.OCVO.D6A@ferranti.com> <1992Apr14.083505.9432@newshost.lanl.gov> <id.5JWO.UZ5@ferranti.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.misc
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!ames!agate!dog.ee.lbl.gov!hellgate.utah.edu!lanl!cochiti.lanl.gov!jlg
From: jlg@cochiti.lanl.gov (Jim Giles)
Subject: Undefined (was: Fortran90 and Arrays)
Message-ID: <1992Apr15.180551.24861@newshost.lanl.gov>
Sender: news@newshost.lanl.gov
Organization: Los Alamos National Laboratory
References: <STEPHEN.92Apr11201347@estragon.uchicago.edu> <id.OCVO.D6A@ferranti.com> <1992Apr14.083505.9432@newshost.lanl.gov> <id.5JWO.UZ5@ferranti.com>
Date: Wed, 15 Apr 1992 18:05:51 GMT
Lines: 38