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


Aldy Hernandez <aldyh@redhat.com> writes:

|> > > 	foo(((vector int){0, 1, 2, 3}));
|> > 
|> > I'm probably wrong, but to me it sounded like the guys where smoking the old 
|> > "but macros should behave exactly like functions" pipe. Looks like the smoke 
|> > haven't cleared yet.
|> 
|> well they should... especially since ansi says that library functions
|> (ahem, printf, strlen, etc), can be implemented as macros.  they *should*
|> behave like functions.
|> 
|> and now with C99 bringing about these {aggregate initilizers}, this
|> are bound to get broken, if you pass them around.

As I wrote earlier, that hole could have been plugged by making parens
around compound literals mandatory.

But there is already another feature that breaks when you turn a function
into a macro: preprocessing directives inside argument lists.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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