regcmp(1)

Tony Walton olapw at olgb1.oliv.co.uk
Fri Jul 22 22:55:21 AEST 1988


In article <757 at vsi.UUCP>, sullivan at 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



More information about the Comp.bugs.sys5 mailing list