Re: Reading external variables from a library (BIND)
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: Reading external variables from a library (BIND)         

Group: comp.lang.fortran · Group Profile
Author: Steven G. Kargl
Date: Sep 16, 2008 19:12

In article comcast.com>,
glen herrmannsfeldt ugcs.caltech.edu> writes:
> Steven G. Kargl wrote:
> (snip)
>
>> From FreeBSD /usr/include/errno.h,
>
>> #ifndef _KERNEL
>> #include
>> __BEGIN_DECLS
>> int * __error(void);
>> __END_DECLS
>> #define errno (* __error())
>> #endif
>
>> errno is not required to be an int variable.
>> It is required to be a modifable lvalue.
>
> In K&R2, the closest I have to a copy of the C89
> standard, errno is described as an expression.
> It is supposed to be close to the final draft of the
> standard, similar to what we have for Fortran 2003.

C89 isn't the C standard. Trying finding n869.pdf and
n1124.pdf. n1124.pdf is probably the most relevant in
that it is a committee draft of the C standard
Errno is not described as an expression.

Section 7.5, p186

; and
errno
which expands to a modifiable lvalue[171] that has type int, the value
of which is set to a positive error number by several library functions.
It is unspecified whether errno is a macro or an identifier declared with
external linkage. If a macro definition is suppressed in order to access
an actual object, or a program defines an identifier with the name errno,
the behavior is undefined.

[171] The macro errno need not be the identifier of an object. It might
expand to a modifiable lvalue resulting from a function call (for
example, *errno()).

See above FreeBSD code for an example of [171]

--
steve
--
steve
no comments
diggit! del.icio.us! reddit!