bodr...@mail.dm.unipi.it writes: 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... #if WANT_ASSERT #define ASSERT_OR_HINT(expr) ASSERT(expr) #else #define ASSERT_OR_HINT(expr) HINT(expr) #endif I am interested if that even makes the object code change with some gcc version. Better try a recent one.
If an ASSERT contains a volatile pointer one better avoids the HINT thing. Torbjörn Please encrypt, key id 0xC8601622 _______________________________________________ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel