This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Improving math function wrappers
- From: Zack Weinberg <zackw at panix dot com>
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Date: Tue, 4 Apr 2017 13:41:42 -0400
- Subject: Re: Improving math function wrappers
- Authentication-results: sourceware.org; auth=none
- References: <AM5PR0802MB2610AA7EDC518B39F6D7152683260@AM5PR0802MB2610.eurprd08.prod.outlook.com> <AM5PR0802MB261064538EBF55E8B7CF1F7783260@AM5PR0802MB2610.eurprd08.prod.outlook.com> <alpine.DEB.2.20.1703161407060.3566@digraph.polyomino.org.uk> <58CAD45E.6050601@arm.com> <alpine.DEB.2.20.1703161816370.18031@digraph.polyomino.org.uk>
On Thu, Mar 16, 2017 at 2:24 PM, Joseph Myers <joseph@codesourcery.com> wrote:
> On Thu, 16 Mar 2017, Szabolcs Nagy wrote:
>> On 16/03/17 14:29, Joseph Myers wrote:
>> > On Thu, 16 Mar 2017, Wilco Dijkstra wrote:
>> >
>> >> Given other languages don't even have the concept of errno, C99 doesn't
>> >> require it, and no application ever reads errno, it is inefficient to
>> >> force the use of the wrappers in almost all cases.
>> >
>> > C99 not requiring it was an incompatible quiet change from C90.
>>
>> i think glibc only has to set errno when user code is
>> compiled with c89 compatibility and even then only for
>> math functions that were defined in c89 and then only
>> guarantee correct errno setting in default rounding mode
>> (c89 code cannot access the fenv).
>
> Incompatible quiet change means a good idea to implement the compatible
> mode ((math_errhandling & MATH_ERRNO) != 0) as far as possible. Just like
> it's a good idea to avoid size_t wider than unsigned long.
In this case, I seriously question whether anyone _wants_ math
functions to set errno, ever, even in C89-era code.
Can we try to find out? It ought to be possible to trawl
numerical-computation codebases for references to errno... (I don't
have anything like the time to do it, alas)