Improving math function wrappers
Zack Weinberg
zackw@panix.com
Tue Apr 4 17:41:00 GMT 2017
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)
More information about the Libc-alpha
mailing list