Define in -fast
By Darryl Gove on Dec 15, 2006
There is a #define included in -fast. It's the rather petulantly named MATHERR_ERRNO_DONTCARE. This tells the compiler that some maths library functions don't have side effects (like setting errno), so the compiler can assume that the errno variable is unchanged by the call. Of course the library code is still free to change errno, it's just the that the compiler will assume that the variable hasn't changed.
The documentation contains an example.
Examining the actual header (/usr/include/math.h) file shows that the pragma used are:
- #pragma does_not_read_global_data(
). So global data does not need to be stored back to memory before the function is called.
- #pragma does_not_write_global_data(
). So global data does not need to be reloaded after the function call returns.
- #pragma no_side_effect(
). So the function call can be eliminated if the result of the call is not used.
This only affects the errno variable for the floating point routines, and it basically tells the compiler that the programmer is not interested in whether the errno variable is changed or not.