Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site utcsri.UUCP Path: utzoo!utcsri!greg From: greg@utcsri.UUCP (Gregory Smith) Newsgroups: comp.lang.c Subject: Re: A Deficiency of the C Preprocessor Message-ID: <3820@utcsri.UUCP> Date: Mon, 22-Dec-86 16:56:30 EST Article-I.D.: utcsri.3820 Posted: Mon Dec 22 16:56:30 1986 Date-Received: Mon, 22-Dec-86 19:35:47 EST References: <1259@kontron.UUCP> <1888@batcomputer.tn.cornell.edu> <4863@mimsy.UUCP> Reply-To: greg@utcsri.UUCP (Gregory Smith) Organization: CSRI, University of Toronto Lines: 47 Summary: >>In article <1259@kontron.UUCP> cramer@kontron.UUCP (Clayton Cramer) writes: >>>I've got a complaint about the C preprocessor -- I doesn't support a >>>repetition for initializing data structures. > In article <4863@mimsy.UUCP> chris@mimsy.UUCP (Chris Torek) writes: >Why is this a complaint about the preprocessor? The preprocessor >knows nothing about data structures. Yes, but it could still make repeated text, which could be used to create repeated data structures, code, or what have you. You have missed Clayton's point. >In article <1888@batcomputer.tn.cornell.edu> >braner@batcomputer.tn.cornell.edu (braner) writes: >>As for compile vs. run time initialization of arrays: A compiler I >>use creates code for all the initializations in the program ... >>Even worse, when an array is initialized, this compiler generates a line >>of code to initialize each entry, rather than an image of the array and >>looping code. > [Chris again]. >That sounds like a pretty poor compiler to me. Whose is it, that >we may all avoid buying it? I have never seen a C compiler that does this, but I know of another supposedly powerful language compiler that does. And of course there is P*sc*l, which not only does this but forces the programmer to write out the code too [i.e. there are no compile-time inits]. It isn't really that bad on a virtual memory machine, since the initial- ization code is only used once, and will be quickly paged out forever. Hopefully the link environment is such that this code is all bunched together. If I say: foo(){ static int bar=0; ... then 'bar' must be set to zero sometime before the first call to 'foo', and must *not* be set to zero on subsequent calls to foo. On braner's compiler, does this work, and if so, how? Does the compiler put 'CLR bar' into a separate code area which is executed at startup? This sounds like more trouble than real initialization... -- ---------------------------------------------------------------------- Greg Smith University of Toronto UUCP: ..utzoo!utcsri!greg Have vAX, will hack...