Liste des Groupes | Revenir à c arch |
I would say the key flag here is "-fno-math-errno" (which is included
in -ffast-math). While I personally think most floating point code
could be used just as well with "-ffast-math", and it is certainly
appropriate for my own code, others have significantly different
opinions or experiences. (That's fair enough.) That one flag simply
disables setting errno in maths functions that can (reasonably) be
implemented inline as instructions, without affecting the results of
any other floating point operations.
>
But to my mind, this is /not/ a case of the POSIX programmer making
the choice - it is an implementation-specific feature. A C compiler
might choose to always use errno, or never, or have some other control
of the use of errno. When you write "POSIX leaves it up to the
programmer", I take that to mean POSIX specifies a function that lets
you change the value of "math_errhandling". That is quite different
from saying "gcc has a flag that lets you choose".
(For my own use, I like the flag - I don't write POSIX code, I have
never had any use for errno, and I want the compiler to generate as
few instructions as it possibly can.)
Les messages affichés proviennent d'usenet.