IsUnsigned() function (retiring injured)

Rick Jones rick at .tetrauk.UUCP
Mon Jul 30 19:46:32 AEST 1990


I knew I should have kept out of this!

My suggestion [#define IsUnsigned(a) (a >= 0 && ~a > 0)] will spot a compiler
with wrong promotion of short types, but I have to admit the macro fails with
ANSII promotion, while working with old K&R.  Comes of using pretend ANSII
compilers, I suppose, and K&R version 2 is _horribly_ ambiguous about "~".

Perhaps I finally understand the ANSII promotion rules at last!

-- 
Rick Jones					You gotta stand for something
Tetra Ltd.  Maidenhead, Berks			Or you'll fall for anything
rick at tetrauk.uucp (...!ukc!tetrauk.uucp!rick)	     - John Cougar Mellencamp



More information about the Comp.lang.c mailing list