delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/03/10/21:02:02

Date: Tue, 10 Mar 1998 21:02:00 -0500 (EST)
Message-Id: <199803110202.VAA00208@delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: eldredge AT ap DOT net
CC: djgpp-workers AT delorie DOT com
In-reply-to: <199803110141.RAA22234@adit.ap.net> (message from Nate Eldredge
on Tue, 10 Mar 1998 17:41:15 -0800 (PST))
Subject: Re: errno constants in <errno.h>

> >> BTW, does anyone whether know whether assigning to errno by a user
> >> program is portable behaviour? From what I have read, errno could even
> >> be the result of a function call (i.e. an r-value)
> >
> >Yes, errno doesn't have to be an lvalue.  A case in point is a 
> >multi-threaded environment, where you'd like each thread to have its own 
> >errno.
> 
> *Really?* But I believe there are cases where there's no other option. This

The ANSI spec states that errno must be a modifiable lvalue.  That
doesn't mean it can't be the result of a function.  It could be thus:

#define errno (*get_errno_pointer())

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019