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]
Other format: [Raw text]

Re: rfc: macros accepting constructors


[Piggybacking as I haven't seen the original yet]

joern.rennecke@superh.com (Joern Rennecke)  wrote on 28.06.02 in <3D1C9999.B49FB83A@superh.com>:

> Aldy Hernandez wrote:
> > well they should... especially since ansi says that library functions
> > (ahem, printf, strlen, etc), can be implemented as macros.  they *should*
> > behave like functions.

Not according to the standard.

Acording to the standard, the allowance of implementing them as macros  
means that the programmer is expected to take the necessary care, and  
either avoid stuff you can't do with macros, or #undef the macro in  
question.

It does *not* mean the compiler has to bend over backwards to make that  
difference vanish.

That said, I *would* like to have some way to get macros to balance *any*  
kind of parens, not just the () kind. A compiler switch would be good  
enough for me - while I have macros which *produce* unbalanced parens, I  
don't have any that expect them in their arguments. I expect few people  
will have them - but it should most definitely be possible to have the  
compiler behave exactly as the standard says.

MfG Kai


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