This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [patch] beginnings of the macro rewrite


On Fri, Apr 21, 2000 at 04:15:54PM -0400, Horst von Brand wrote:
> Stan Shebs <shebs@apple.com> said on gcc-patches:
> > Zack Weinberg wrote:
> > > IMPORTANT: This drops support for traditional macros.  I will put it
> > > back if people complain loudly enough.  If no one cares then I will
> > > probably drop -traditional entirely, sometime next week.
> > > -Wtraditional still works.
> 
> > It might not get too much reaction on this list, but I suggest
> > you make this checkin anonymously, so the lynch mob of users
> > won't be able to come find you. 1/2 :-)
> > 
> > -traditional will be important to support in GCC for at least
> > another 10 years, possibly longer, depending on the longevity
> > of various old code bases.
> 
> Could somebody enlighten me about what "traditional macros" is being talked
> here?

K+R has significantly different semantics for macro expansion from
standard C.  Highlights include:

- macros are not disabled during their own expansions.  The practical
  effect is that

#define EPERM EPERM

  will cause infinite recursion if you use EPERM anywhere.  There are
  some perverse cases where it might actually be useful, though.

- macro arguments are expanded even inside strings and character
  constants (but no effort is made to quote special characters).

- the # and ## (stringize and paste) operators are not available.

- comments are replaced by nothing _after_ arguments are substituted,
  which means /**/ can be used to paste tokens.

- there is no special protection against accidental token paste; if
  you write

#define foo(x) x+b
foo(+);

you'll get ++b; instead of + +b;

zw

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]