Path: utzoo!utgpu!water!watmath!clyde!att!pacbell!lll-tis!helios.ee.lbl.gov!pasteur!agate!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!ukc!eagle!icdoc!ist!olgb1!olapw From: olapw@olgb1.oliv.co.uk (Tony Walton) Newsgroups: comp.bugs.sys5 Subject: Re: regcmp(1) Summary: .i is used to save a redundant cpp invocation Message-ID: <539@olgb1.oliv.co.uk> Date: 22 Jul 88 12:55:21 GMT References: <757@vsi.UUCP> Distribution: comp Organization: British Olivetti Ltd.,OEM/VAR Division, London, England. Lines: 32 In article <757@vsi.UUCP>, sullivan@vsi.UUCP (Michael T Sullivan) writes: > The default when regcmp(1) is called by: > > regcmp file > > is to put its output into "file.i", with the idea that "file.i" is #include'd > into your C source file. Shouldn't this be "file.h", especially in light > of the fact that the .i suffix is used by "cc -P" for its output? ...... As I understand it, the sequence is prog.c ---> /lib/cpp ---> prog.i (preprocessor stage) prog.i ---> /lib/comp ---> prog.s (compilation to native assembler code) and so on. The prog.i, prog.s etc aren't normally seen unless you stop the sequence (cc -P runs only as far as the creation of prog.i, for example). cc is "intelligent" enough to run only the relevant parts of the subsystem; there's no point, for example, in running cpp on a file which has either already been preprocessed or which doesn't need it anyway (ie it has no comments, #defines, #includes, etc. regcmp produces code which needs no cpp run; this is shown by putting it in a .i file. You then #include the file in a .c file (the .h suffix is purely a convention, by the way). cpp is run on this .c file and the .i file is included. -- Tony Walton, OEM/VAR Division, British Olivetti Ltd., Wellington House, 154-160 Upper Richmond Road, London, England SW15 2FN LONDON, SW15 2FN. Tel: (+44) 1 789 6699 Telefax: (+44) 1 785 6670 Telex:27258 Uucp : { ukc | mcvax!olnl1 | ihnp4!cuuxb | iconet | olhqma } !olgb1!olapw