Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 9 Mar 2012 11:01:04 -0500
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Subject: Re: libm

On Fri, Mar 09, 2012 at 11:57:03AM +0100, Szabolcs Nagy wrote:
> > 2. You could add something like:
> > #ifdef __GNUC__
> > #define __RETCAST(x) (__typeof__((x))
> > #else
> > #define __RETCAST(x)
> > #endif
> > Then add __RETCAST((x)), __RETCAST((x)+(y)), etc. Some trick will be
> > needed to make integer types result in a cast to double, though.
> > 
> 
> ok, that makes sense
> 
> actually i'm not sure when the extra () protection
> is needed like __typeof__((x))
> (the reason for it in (x)+(y) is clear)
> 
> is it because single argument macros might get
> called with a comma expression?
> 
> so
> #define A(x) B((x))
> is ok
> 
> but
> #define A(x,y) B((x),(y))
> is redundant

It's probably redundant. Only case I can think of where it might help
is improving(?) the error reporting when some invalid-as-macro-arg
expressions that use ?: as a grouping for a comma operator in the
second operand, or perhaps some fishy stuff with compound literals.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.