rfc: macros accepting constructors

Aldy Hernandez aldyh@redhat.com
Wed Jun 26 19:09:00 GMT 2002


On Wed, Jun 26, 2002 at 10:36:06AM +0200, Andreas Schwab wrote:
> Aldy Hernandez <aldyh@redhat.com> writes:
> 
> |> the cleanest solution i can think of is modifying the preprocessor to
> |> allow grouping with curlies as well.
> 
> That would not be compliant with the C standard.

i know, but neither will any standard library functions that are 
implemented as macros.  take a pick: a little flexibility on macro
arguments, or inability to pass constant aggregates to library functions 
(that have been implemented as macros).  you can't have both.

of course, this wouldn't be implemented for -ansi.

> |>  can anyone think of a better solution?
> 
> Put parens around the argument.  IMHO, the C standard should have made
> them part of the syntax for compound literals.

but they're not part of the ISO C standard :-(

aldy



More information about the Gcc mailing list