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 05:22:39 -0500
From: Rich Felker <>
Subject: Re: libm

On Mon, Mar 05, 2012 at 04:17:11PM +0100, Szabolcs Nagy wrote:
> * Rich Felker <> [2012-03-05 09:04:59 -0500]:
> > On Mon, Mar 05, 2012 at 09:51:35AM +0100, Szabolcs Nagy wrote:
> > Hm? If you need a macro to test whether an argument is an integer or
> > floating point, try this:
> > 
> > #define __IS_FP(x) !!((1?1:(x))/2)
> > 
> oh nice
> (and subtle)

I checked out your latest tgmath.h; it's surprisingly clean and
readable! A couple ideas..

1. __fun could be just fun (macro arguments are free of namespace

2. You could add something like:
#ifdef __GNUC__
#define __RETCAST(x) (__typeof__((x))
#define __RETCAST(x)
Then add __RETCAST((x)), __RETCAST((x)+(y)), etc. Some trick will be
needed to make integer types result in a cast to double, though.


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.