Mail Archives: djgpp-workers/1998/03/11/06:39:43
On Wed, 11 Mar 1998, Hans-Bernhard Broeker wrote:
> In other words: it's always an lvalue, but not necessarily a simple
> variable.
>
> > The scheme I saw suggested was to do:
> >
> > errno = 0; /* or EOK */
> > y = sqrt(x);
> > if (errno == EDOM) ...
>
> This scheme happens to be explained in the following footnote in the
> Standard, yes. But then, there *have* to be better ways of handling such
> conditions.
Even though errno is an lvalue, it still makes sense to not assign
anything BUT ZERO to it. For example, if we have
#define errno (*get_errno_value())
then "errno = 0;" is OK, but "errno = EACCES;" is *not*.
I gather that is the reason for those "errno should be read-only"
comments I've seen.
- Raw text -