lkml.org 
[lkml]   [2003]   [Dec]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: GCC 3.4 Heads-up
On Fri, 26 Dec 2003, Andy Isaacson wrote:

> On Thu, Dec 25, 2003 at 08:34:33PM -0800, Linus Torvalds wrote:
> > The cast/conditional expression as lvalue are _particularly_ ugly
> > extensions, since there is absolutely zero point to them. They are very
> > much against what C is all about, and writing something like this:
> >
> > a ? b : c = d;
> >
> > is something that only a high-level language person could have come up
> > with. The _real_ way to do this in C is to just do
> >
> > *(a ? &b : &c) = d;
> >
> > which is portable C, does the same thing, and has no strange semantics.
>
> But doesn't the first one potentially let the compiler avoid spilling to
> memory, if b and c are both in registers?

I can't imagine anything wrong with:

if (a) b = d else c = d;

- D
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:59    [W:0.097 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site