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: ANSI C -- static forward references Message-ID: <3813@utcsri.UUCP> Date: Fri, 19-Dec-86 15:08:37 EST Article-I.D.: utcsri.3813 Posted: Fri Dec 19 15:08:37 1986 Date-Received: Fri, 19-Dec-86 23:24:09 EST References: <108@decvax.UUCP> <5455@brl-smoke.ARPA> <114@decvax.UUCP> Reply-To: greg@utcsri.UUCP (Gregory Smith) Organization: CSRI, University of Toronto Lines: 50 Summary: In article <114@decvax.UUCP> minow@decvax.UUCP (Martin Minow) writes: >Discussing my suggestion to change the interaction between "static" >and "extern", Doug Gwyn (@ brl-smoke) notes that the Draft Standard's >semantics were designed to permit one-pass compilation. > >Are there still true one-pass compilers being written today? My impression >is that the minimum hardware being sold today is something on the order >of a Macintosh or Atari ST, both of which support full-featured, multi-pass >compilers. I would much prefer the Standard be written for the current >(and future) "minimum" computer, rather than for some very limited >10-year old microcomputer. In article <264@mordor.s1.gov> jdb@mordor.UUCP (John Bruner) writes: >The last time I looked, PCC2 was a one-pass compiler. I think there is some confusion here. C compilers are normally 'One-pass' in the sense that they can generate code for X without requiring any information about the source which appears after X. Assemblers (normal assemblers anyway) cannot be one-pass in this sense, since they need to resolve forward references. A 'multi-pass' compiler is usually a bunch of programs which pipe their data from one to the other (The PCC2 can be considered 2-pass in this sense since it reads the output of the preprocessor). However, the entire system acts as a one-pass compiler, again, since code (assembler) is generated for X without knowing what comes after X. To compile stuff on this machine, e.g. 'cc -o foo foo.c', foo.c is run thru /bin/cpp, /bin/ccom, [ and /bin/c2 if you say -O ]. Then the assembler makes two passes on the output, and the linker probably makes two passes on the object module. Now do cpp and ccom count as two passes? Some pcc implementations split ccom into two stages, each of which is essentially a filter. Am I the only one who thinks there is a terminology problem here? I would like to see the word 'stage' used for a section of a pipe, while 'pass' refers to the number of times a module must read its input stream. So a compiler could be referred to as a '3-stage, 1-pass' compiler. Of course, the distinction applies whether pipes or intermediate files are used between stages. The use of temp files to delay such things as string constants is not really an issue here, since it has such a minor impact on the compiler design (Strictly speaking, when a pcc reopens this temp file in order to spool its contents onto the end of the .s file, it is making a second pass, since it is 'backing up' and re-examining information gleaned from the first 'pass'). -- ---------------------------------------------------------------------- Greg Smith University of Toronto UUCP: ..utzoo!utcsri!greg Have vAX, will hack...