[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.LFD.1.10.0807290936090.3334@nehalem.linux-foundation.org>
Date: Tue, 29 Jul 2008 09:44:17 -0700 (PDT)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Ingo Molnar <mingo@...e.hu>
cc: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Stephen Rothwell <sfr@...b.auug.org.au>,
David Miller <davem@...emloft.net>, linux-next@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Mike Travis <travis@....com>
Subject: Re: linux-next: build failure
On Tue, 29 Jul 2008, Linus Torvalds wrote:
>
> [...] since statement expressions are gcc
> extensions, and as such the gcc people could make up any semantics they
> want to them, including just defining that a statement expression with
> an lvalue value is the same lvalue rather than any temporary).
In fact, that does seem what gcc-4.x does. The way to tell is to do
const int *x;
({ *x }) = 1;
and it's (a) legal (assignments to non-lvalues wouldn't work) and (b)
gives a nice warning about assignment to read-only location, which in turn
implies that the compiler properly just peeled off the de-reference even
though it was inside the statement expression.
IOW, at least in gcc-4.3 (and apparently in earlier gcc-4 versions, but
not in gcc-3.4.5), a statement expression with an lvalue return value _is_
actually an lvalue.
But that also means that there is no difference what-so-ever between (x)
and ({ x; }) in gcc-4. And in gcc-3 there is, because apparently in gcc-3
a statement expression is never an lvalue (which is actually the sane
thing, imho).
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists