Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!henry From: henry@utzoo.UUCP (Henry Spencer) Newsgroups: comp.lang.c Subject: Re: Incrementing of preprocessor symbols Message-ID: <7936@utzoo.UUCP> Date: Sat, 18-Apr-87 23:35:14 EST Article-I.D.: utzoo.7936 Posted: Sat Apr 18 23:35:14 1987 Date-Received: Sat, 18-Apr-87 23:35:14 EST References: <3424@vrdxhq.UUCP> Organization: U of Toronto Zoology Lines: 27 Keywords: C #define > So, the problem is how to get an that increments with each usage in the > source. Note that should NOT be incremented each time the statment is > encountered during execution; a lexical increment is desired. > > We are not looking to use a pre-preprocessor... looking for a solution > entirely within the C preprocessor. You are out of luck; there is none that I can see. > I would note that any self-respecting macro facility for any assembler can do > this sort of thing with its eyes closed and one macro expansion behind its > back. If as I am beginning to suspect, this is not possible with C, then > perhaps the C standards committee might take note. The C standards committee has been most explicit, as I recall, that the C preprocessor is not a general-purpose macro processor and they have no intention of turning it into one. If somebody had actually implemented something like this, used it, and found it workable, in *C* and not some other random language, they might consider it (maybe; it's a bit late). That aside, it just requires too much invention and is too great a departure from existing C experience. The ANSI C committee is not in the business of making C all things to all users; despite some ill-advised (in my personal opinion) changes, they are basically standardizing an existing language rather than inventing a new one. -- "If you want PL/I, you know Henry Spencer @ U of Toronto Zoology where to find it." -- DMR {allegra,ihnp4,decvax,pyramid}!utzoo!henry