bodrato at bodrato at
Sun Feb 23 10:58:06 UTC 2014


Il Ven, 17 Gennaio 2014 1:10 pm, Vincent Lefevre ha scritto:
> you may also have optimizations based on the fact that some variable
> cannot be zero. But you have no types that don't include zero. The
> right solution is to make sure that the compiler knows the range.

> #define HINT(expr) ((expr) || (__builtin_unreachable(), 0))

This can be interesting in some contexts.
Moreover, most of the ASSERTs we have in the code might be changed into
HINTs when we do not want asserts, because they can give some information
to the compiler...

 #define ASSERT_OR_HINT(expr) ASSERT(expr)
 #define ASSERT_OR_HINT(expr) HINT(expr)

Then we might use ASSERT_OR_HINT ((n) >= 0) ...



More information about the gmp-devel mailing list