This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Volatile MEMs in statement expressions and functions inlinedastrees
- From: Linus Torvalds <torvalds at transmeta dot com>
- To: Paul Schlie <schlie at mediaone dot net>
- Cc: Aldy Hernandez <aldyh at redhat dot com>, Richard Henderson <rth at redhat dot com>, <gdr at codesourcery dot com>, Jason Merrill <jason at redhat dot com>, <gcc-patches at gcc dot gnu dot org>, Alexandre Oliva <aoliva at redhat dot com>
- Date: Tue, 18 Dec 2001 22:01:49 -0800 (PST)
- Subject: Re: Volatile MEMs in statement expressions and functions inlinedastrees
On Tue, 18 Dec 2001, Paul Schlie wrote:
>
> To be more clear, it would appear that:
>
> statement <- assignment-expression <- ? <- variable <- "p"
>
> Don't see how to get there from "p".
No.
The C language doesn't even _have_ a "assignment statement".
Assignments are just expressions. And expressions are built up from
sub-expressions.
It's perfectly valid C to write
1+1;
as a statement. It's a statement expression, with the value 2. Obviously
that value is not actually _used_ for anything, so very few people write
programs like that, which is why it looks strange (and most compilers will
warn about "statement with no effect").
Linus