detecting -ffast-math at compile time

Ian Lance Taylor iant@google.com
Fri Mar 27 16:18:00 GMT 2009


Rohit Garg <rpg.314@gmail.com> writes:

> If I wish to detect if the compiler options include -ffast-math, which
> macro should I define? This is useful if I want to select which path
> of the code to compile depending on my needs with just a compiler
> switch. Eg. for SSE2, __SSE2__(or it's cousin) is defined.

Check for __FAST_MATH__.

The gcc manual documents this is in the description of -ffast-math.

Ian



More information about the Gcc-help mailing list