Ciao, Il Mar, 3 Settembre 2019 8:06 am, Niels Möller ha scritto: > I think we discussed this earlier, but I don't recall the conclusion, if
I do not remember if we actually discussed, but surely we talked about... > any. Would it make sense to use ASSERT to guide the compiler, and define > it like > > #define ASSERT(expr) do { if (!(expr)) __builtin_unreachable(); } while > (0) I'd not agree. I mean: I like the idea of hinting to the compiler, but I'd use a different macro. Something like ASSERT_OR_HINT, or simply HINT. You are right, there are places like the following. > ASSERT_CODE (char *bp_orig = bp - bytes); > ... > ASSERT (bp > bp_orig); They will be easily detected while compiling, the symbol is undefined... But we also have ASSERTs that calls functions! e.g. in mpn/generic/hgcd_reduce.c we have, twice, the line: ASSERT (mpn_zero_p (tp + nn, modn - nn)); that hardly translate into a good hint for the compiler... And we should re-define ASSERT in tests/refmpn.c ... If we use a new macro and manually convert some ASSERTs to HINTs, the transition will be slower, but safer. Ĝis, m -- http://bodrato.it/papers/ _______________________________________________ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel