🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4547

Re: Can longjmp modify errno?

#4547
From: Stephen Baynes
Date: Tue, 02 Jan 1996 08:38
41 lines
1994 bytes
Dan Pop (danpop@mail.cern.ch) wrote:
: >> However, errno is an lvalue, and the object designated by this lvalue
: >> is definitely accessible.
: >
: >But "the object" may be a different object at a different time.
: >
: Even if it is a different object at a different time, this should be
: transparent to a conforming program.  Consider this example:

: #imclude <errno.h>
: #include <stdlib.h>

: void blah(int i)
: { 
:     errno = i;
: }

: int main(void)
: {
:     int i = 3;
:     blah(i);
:     if (i == errno) return EXIT_SUCCESS;
:     return EXIT_FAILURE;
: }

: Is this code allowed to return an unsuccessful termination status to
: the host environment?

I would agreee that the intent on ISO C 7.1.4 (as given in Plauger) is
that errno is a single value, however I would say that on a strict
reading that is not assured. Also nothing is said except in footnotes
about  applications setting errno. The mention is in footnote 93 where
it only talkes about setting it to zero, so strictly assigning anything
other than zero could have undefined or implementation specific
behaviour. The wording of this section could be improved.

--
Stephen Baynes                              baynes@mulsoc2.serigate.philips.nl
Philips Semiconductors Ltd
Southampton                                 My views are my own.
United Kingdom
Technical Details
Message-ID: <DKJpC1.LvD@ukpsshp1.serigate.philips.nl>
Path: arc1-ca.pugleaf.net!phcoms4.seri.philips.nl!panther!baynes
References: <DJEADH.HwC@nntpa.cb.att.com> <30cd018a.13538688@nntp.ix.netcom.com> <1995Dec12.185335.8791@sq.com> <danpop.818847488@rscernix> <1995Dec13.233015.28627@sq.com> <danpop.818964974@rscernix>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!phcoms4.seri.philips.nl!panther!baynes
From: baynes@ukpsshp1.serigate.philips.nl (Stephen Baynes)
Subject: Re: Can longjmp modify errno?
Sender: news@ukpsshp1.serigate.philips.nl (account for localnews)
Message-ID: <DKJpC1.LvD@ukpsshp1.serigate.philips.nl>
Date: Tue, 2 Jan 1996 08:38:25 GMT
References: <DJEADH.HwC@nntpa.cb.att.com> <30cd018a.13538688@nntp.ix.netcom.com> <1995Dec12.185335.8791@sq.com> <danpop.818847488@rscernix> <1995Dec13.233015.28627@sq.com> <danpop.818964974@rscernix>
Organization: Philips Semiconductors, Southampton, UK
X-Newsreader: TIN [version 1.2 PL2]