Re: linux-next: build failure

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linus Torvalds
Date: Tuesday, July 29, 2008 - 9:44 am

On Tue, 29 Jul 2008, Linus Torvalds wrote:

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
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
linux-next: build failure, Stephen Rothwell, (Mon Jul 28, 11:23 pm)
Re: linux-next: build failure, Ingo Molnar, (Tue Jul 29, 1:00 am)
Re: linux-next: build failure, Stephen Rothwell, (Tue Jul 29, 1:03 am)
Re: linux-next: build failure, Wenji Huang, (Tue Jul 29, 1:14 am)
Re: linux-next: build failure, Ingo Molnar, (Tue Jul 29, 1:58 am)
Re: linux-next: build failure, KOSAKI Motohiro, (Tue Jul 29, 4:28 am)
Re: linux-next: build failure, Ingo Molnar, (Tue Jul 29, 4:40 am)
Re: linux-next: build failure, Mike Travis, (Tue Jul 29, 7:31 am)
Re: linux-next: build failure, Mike Travis, (Tue Jul 29, 7:33 am)
Re: linux-next: build failure, Linus Torvalds, (Tue Jul 29, 9:26 am)
Re: linux-next: build failure, Linus Torvalds, (Tue Jul 29, 9:33 am)
Re: linux-next: build failure, Ingo Molnar, (Tue Jul 29, 9:42 am)
Re: linux-next: build failure, Linus Torvalds, (Tue Jul 29, 9:44 am)