Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!ucla-cs!zen!ucbvax!decvax!ima!haddock!karl From: karl@haddock.ISC.COM (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Does ANSI C have lengthof() ? Message-ID: <1059@haddock.ISC.COM> Date: Fri, 4-Sep-87 17:34:10 EDT Article-I.D.: haddock.1059 Posted: Fri Sep 4 17:34:10 1987 Date-Received: Sat, 5-Sep-87 20:47:26 EDT References: <9154@brl-adm.ARPA> <1265@mhres.mh.nl> Reply-To: karl@haddock.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Boston Lines: 20 In article <1265@mhres.mh.nl> jv@mhres.mh.nl (Johan Vromans) writes: >I think there is more need for these functions in the pre-processor: > # if sizeof (char*) == sizeof (int) I've often wanted this sort of thing myself, but have grudgingly had to accept the fact that a preprocessor that only examines "#" lines cannot possibly understand "sizeof(time_t)". But, ignoring for the moment the question of whether it's "good" that the preprocessor doesn't know C, this enhancement shouldn't require all that much "spurious knowledge", should it? In particular, couldn't one write a cpp that recognizes "typedef" declarations? Such a preprocessor ought to be able to handle any "sizeof(TYPE)" expression, and I'd be willing to do without "sizeof(EXPR)". Has anyone tried to write such a preprocessor? Or is the problem more subtle than this? (Restricted-scope typedefs complicate things, but not much; and nobody uses them, anyway.) Karl W. Z. Heuer (ima!haddock!karl or karl@haddock.isc.com), The Walking Lint