This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libc/include/sys/errno.h


>>> On Wed, 23 Apr 2003 12:02:20 -0400
>>> "J. Johnston" <jjohnstn at redhat dot com> said:

> Unfortunately, the variable is not historically declared
> const.  If you look at glibc, djgpp, and BSD, you will see
> that is declared as newlib does.  Therefore, the declaration
> should be left as-is.

The reason isn't only historical, but also compliant to the
standard. If it is declared const, the following code described
as the typical way of using errno in "C A Reference Manual"
can't work anymore.

    errno = 0;
    x = sqrt(y);
    if (errno) {
        printf("?sqrt failed, code %d\n", errno);
	x = 0;
    }
____
  | AIST      Kazuhiro Fujieda <fujieda at jaist dot ac dot jp>
  | HOKURIKU  Center for Information Science
o_/ 1990      Japan Advanced Institute of Science and Technology


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]