Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!necntc!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: enum Message-ID: <1337@haddock.ISC.COM> Date: Wed, 7-Oct-87 19:06:32 EDT Article-I.D.: haddock.1337 Posted: Wed Oct 7 19:06:32 1987 Date-Received: Sat, 10-Oct-87 16:36:14 EDT References: <1177@laidbak.UUCP> <1314@haddock.ISC.COM> <11053@orchid.waterloo.edu> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 23 In article <11053@orchid.waterloo.edu> rbutterworth@orchid.waterloo.edu (Ray Butterworth) writes: > extern int enum_foo_lt(); > #if !defined(lint) > # define enum_foo_lt(x,y) ((int)(x) < (int)y) > #endif Yes, I thought about doing something like this. I'll probably do that. (I've been hesitating only because the program in its current form passes lint -- no warnings at all, in 1306 lines -- without using the universal "#ifdef lint" escape and with no (void) casts except on strcpy/strcat. It's a work of art!) >Note that [this] matches nicely with the way ANSI is setting up the standard >library. You include "foo.h" and get access to enum_foo_lt() without knowing >whether it is a macro, a real function, or even a compiler built-in. If you >want to use it as a real function (e.g. take its address) you must first >"#undef enum_foo_lt" and then "func(&enum_foo_lt);". (too bad there isn't a >#pushdef and a #popdef :-) That isn't necessary. "func(&enum_foo_lt)" will get you the real function even without the "#undef", since function-like macros in ANSI C are only recognized when the next token is a left parenthesis. Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint