On 05/05/11 10:24, Eric Blake wrote: >> +In C99, @code{assert} can be applied to any scalar expression. >> > +In C89, the argument to @code{assert} is of type @code{int}. > Is it worth trying to fix that in gnulib, as an independent fix? Are > there any implementations where assert(0x100000000LL) fails instead of > succeeds, because the conversion from long long back to int lost the > non-zero bit?
A more interesting case is assert (P) where P is a pointer. I've written code like that and never had a problem. (But then, how would I know? :-) Another case is assert (0.5). In C89 this must report an assertion failure, but on all practical implementations I know of, it succeeds. So to some extent that C89 requirement never reflected reality, and the C99 change adjusted the standard to match reality better. I wouldn't object to fixing 'assert' so that we're sure that it has C99 semantics, but it's pretty low priority as the problem, I expect, is only theoretical. Also, making the fixed 'assert' report failures in the same way as the original might prove to be a challenge.