🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4481

Re: Can longjmp modify errno?

#4481
From: Mark Brader
Date: Thu, 14 Dec 1995 22:43
21 lines
1123 bytes
> #include <errno.h> /* typo fixed */
> #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?

Possibly by the letter of the standard, but clearly this is not the
intent.  However, this code does not make a library function call
between the two references to errno, and that matters.
-- 
Mark Brader, msb@sq.com | "This is what customers do: they invent everything
SoftQuad Inc., Toronto  |  you haven't thought of."        -- David Slocombe

My text in this article is in the public domain.
Technical Details
Message-ID: <1995Dec14.224308.25551@sq.com>
Path: arc1-ca.pugleaf.net!howland.reston.ans.net!torn!sq!msb
References: <DJEADH.HwC@nntpa.cb.att.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!howland.reston.ans.net!torn!sq!msb
From: msb@sq.com (Mark Brader)
Subject: Re: Can longjmp modify errno?
Message-ID: <1995Dec14.224308.25551@sq.com>
Organization: SoftQuad Inc., Toronto, Canada
References: <DJEADH.HwC@nntpa.cb.att.com> <danpop.818847488@rscernix> <1995Dec13.233015.28627@sq.com> <danpop.818964974@rscernix>
Date: Thu, 14 Dec 1995 22:43:08 GMT