scott@sctc.com (Scott Hammond) (05/02/91)
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? Thanks. -- Scott Hammond scott@sctc.com
gwyn@smoke.brl.mil (Doug Gwyn) (05/02/91)
In article <1991May1.192158.13352@sctc.com> scott@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.
schwartz@groucho.cs.psu.edu (Scott Schwartz) (05/03/91)
gwyn@smoke.brl.mil (Doug Gwyn) writes:
Don't use cpp for anything, please. It need not even exist.
m4 is cute, but cpp does have one advantage over it: it understands
more than one flavor of quotes at a time.
define(x,100)
changequote(',')
foo[x] = 'x';
bar[x] = "x";
allbery@NCoast.ORG (Brandon S. Allbery KB8JRR/AA) (05/03/91)
As quoted from <16031@smoke.brl.mil> by gwyn@smoke.brl.mil (Doug Gwyn): +--------------- | In article <1991May1.192158.13352@sctc.com> scott@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@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
plona@romulus.rutgers.edu (Lawrence Plona) (05/04/91)
Although this has nothing to do with which is the better pre-processor, the 3.2 man page for cpp says not to use it because cpp is part of cc and is subject to change without notice. The cpp man page does not appear in the 4.0 documentation. -- Sit denique inscriptum in fronte unius "Let it finally be written on cuiusque quid de rebus publicis sentiat the forehead of each man what he - Cicero thinks of open systems"