This is the mail archive of the
cygwin-developers@cygwin.com
mailing list for the Cygwin project.
Re: libc/include/sys/errno.h
- From: Kazuhiro Fujieda <fujieda at jaist dot ac dot jp>
- To: "J. Johnston" <jjohnstn at redhat dot com>
- Cc: newlib <newlib at sources dot redhat dot com>, Cygwin Developers <cygwin-developers at cygwin dot com>
- Date: 24 Apr 2003 01:20:30 +0900
- Subject: Re: libc/include/sys/errno.h
- References: <3E9FFD2B.3070001@yahoo.com> <3EA676BE.1070002@yahoo.com><3EA6B90C.1080204@redhat.com>
>>> 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