Re: proposed ARITH_COMPARE macro

2011-05-15 Thread Paul Eggert
On 05/15/11 17:32, Bruno Haible wrote: > Can you do this purely with macros? I think we should start from a > function, or a set of functions (depending on the input types). I was hoping that we could do it with macros, just as the integer overflow tests are done with macros. The advantage of mac

Re: proposed ARITH_COMPARE macro

2011-05-15 Thread Bruno Haible
Hi Paul, > While we're on the topic of C's arithmetic deficiencies, how about if > we also add a macro for safe and portable comparison? Yes, absolutely! It's a deficiency in the C standard libraries that there are no library functions for doing that. > Something like "ARITH_COMPARE (A, OP, B)"

proposed ARITH_COMPARE macro

2011-05-15 Thread Paul Eggert
While we're on the topic of C's arithmetic deficiencies, how about if we also add a macro for safe and portable comparison? Something like "ARITH_COMPARE (A, OP, B)" to compare A and B numerically rather than using C's rules. So, for example, ARITH_COMPARE (-1, <, sizeof "x") would return true ev