cpp vs. m4 for .s files

Brandon S. Allbery KB8JRR/AA allbery at NCoast.ORG
Fri May 3 11:28:59 AEST 1991


As quoted from <16031 at smoke.brl.mil> by gwyn at smoke.brl.mil (Doug Gwyn):
+---------------
| In article <1991May1.192158.13352 at sctc.com> scott at sctc.com (Scott Hammond) writes:
| -Unix source tends to use m4 for macro and constant substitution.
| -I was asked why cpp wouldn't work just as well, but I don't know.  Is
| -there any reason one way or the other for choosing m4 vs. cpp for
| -assembly language files?
| 
| Don't use cpp for anything, please.  It need not even exist.
+---------------

...although I have a cpp-to-m4 preprocessor about half-functional (it doesn't
do #if and botches #ifndef ... #else).  (PLEASE don't ask me for it, I've
about 30 projects at the half-to-75%-done phase and at the rate I'm going none
of them will get finished!)

In any case, m4 wins over cpp because m4 is smarter.  You can do things with
m4 that cpp can't even attempt, like decomposing or altering tokens via
translit(), substr(), etc.  (Admittedly, getting the hang of m4 can make one
prematurely gray....)

++Brandon
-- 
Me: Brandon S. Allbery			  Ham: KB8JRR/AA  10m,6m,2m,220,440,1.2
Internet: allbery at NCoast.ORG		       (restricted HF at present)
Delphi: ALLBERY				 AMPR: kb8jrr.AmPR.ORG [44.70.4.88]
uunet!usenet.ins.cwru.edu!ncoast!allbery       KB8JRR @ WA8BXN.OH



More information about the Comp.unix.wizards mailing list