From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/632 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: libm Date: Fri, 9 Mar 2012 11:57:03 +0100 Message-ID: <20120309105703.GT5728@port70.net> References: <20120227210253.GA25004@port70.net> <20120227222437.GH184@brightrain.aerifal.cx> <20120303225758.GA5728@port70.net> <20120304065340.GT184@brightrain.aerifal.cx> <20120304145041.GB5728@port70.net> <20120304184339.GV184@brightrain.aerifal.cx> <20120305085135.GC5728@port70.net> <20120305140459.GW184@brightrain.aerifal.cx> <20120305151710.GG5728@port70.net> <20120309102239.GC184@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1331290638 26434 80.91.229.3 (9 Mar 2012 10:57:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 9 Mar 2012 10:57:18 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-633-gllmg-musl=m.gmane.org@lists.openwall.com Fri Mar 09 11:57:17 2012 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1S5xVc-00050k-6j for gllmg-musl@plane.gmane.org; Fri, 09 Mar 2012 11:57:16 +0100 Original-Received: (qmail 9810 invoked by uid 550); 9 Mar 2012 10:57:15 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 9802 invoked from network); 9 Mar 2012 10:57:15 -0000 Content-Disposition: inline In-Reply-To: <20120309102239.GC184@brightrain.aerifal.cx> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:632 Archived-At: * Rich Felker [2012-03-09 05:22:39 -0500]: > 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 > issues) > hm true > 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