Path: utzoo!attcan!uunet!mcsun!ukc!pyrltd!tetrauk!rick From: rick@.tetrauk.UUCP (Rick Jones) Newsgroups: comp.lang.c Subject: Re: IsUnsigned() function (retiring injured) Message-ID: <621@.tetrauk.UUCP> Date: 30 Jul 90 09:46:32 GMT References: <1990Jul27.161339.14712@kfw.COM> <8118@ncar.ucar.edu> Reply-To: rick@tetrauk.UUCP (Rick Jones) Organization: Tetra Ltd., Maidenhead, UK Lines: 13 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@tetrauk.uucp (...!ukc!tetrauk.uucp!rick) - John Cougar Mellencamp