libc/include/sys/errno.h

Christopher Faylor cgf@redhat.com
Wed Apr 23 16:36:00 GMT 2003


On Thu, Apr 24, 2003 at 01:20:30AM +0900, Kazuhiro Fujieda wrote:
>>>> On Wed, 23 Apr 2003 12:02:20 -0400
>>>> "J. Johnston" <jjohnstn@redhat.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;
>    }

That's not an issue.  errno isn't affected by this patch.



More information about the Newlib mailing list