Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 31 Aug 2014 13:31:55 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: musl@...ts.openwall.com
Subject: Re: [PATCH 7/8] add the thrd_xxxxxx functions

* Alexander Monakov <amonakov@...ras.ru> [2014-08-31 15:06:02 +0400]:
> On Sun, 31 Aug 2014, Jens Gustedt wrote:
> > 
> > echo 'int g(void*); int a; int b; int f(int y){ if (y) return g(&a); else return g(&b);} int h(int y) { return y ? g(&a) : g(&b); }' |   gcc -xc - -S -o- -O
> 
> No, your h() is not what is intended.  It should be '{return g{y ? &a : &b);}',
> and it does make a difference.
> 

even with no code gen difference i find

 r = f(c?x:y, u, v, w);

cleaner than

 if (c)
   r = f(x, u, v, w);
 else
   r = f(y, u, v, w);

because the first one makes it clear that only one arg is
changed based on c, the rest of the logic is the same

(maybe the c?x:y should be done on a separate line if the
call becomes too long)

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.