Re: Concept of Statements and Expressions
- From: pete <pfiland@xxxxxxxxxxxxxx>
- Date: Wed, 10 May 2006 19:51:54 GMT
void * clvrmnky() wrote:
pete wrote:
void * clvrmnky() wrote:J'Accuse!
Keith Thompson wrote:
"Vladimir Oka" <novine@xxxxxxxxxxxxxxx> writes:
6.5p1 ExpressionsThis definition is actually inaccurate. For example,
An expression is a sequence of operators and operands
that specifies
computation of a value,
or that designates an object or a function,
or that generates side effects, or that performs a combination
thereof. [...]
42
is clearly an expression,
but it contains no operators and therefore no operands.
(No, there's no implicit invisible operator.)
Not really.
Right. My reasoning is that "42" is an rvalue expression
(where an expression is defined as
"one or more terms and zero or more operators")
consisting of a single term which is an integer constant.
You just made that up.
Made what up, specifically? The definition of an expression?
Yes.
Well
/someone/ made it up, but it sure wasn't me! I (unfortunately) do not
have the real Standard in front of me,
and find it painfully obtuse when I do.
I mostly make do with the brief discussion here:
<http://www-ccs.ucsd.edu/c/express.html>
Is there something wrong
with this general discussion of C expressions?
Not too bad.
A few nits here and there:
"A function-designator subcontext designates a function.
Hence, its expression has a function type.
You create a function-designator subcontext
wherever you need to call a function or determine its address."
You can use an expression of function type to make a function call,
but a pointer to a function expression,
which itself has an object type,
is really what's needed to make a function call.
If a function call is made with an expression of function type,
then that expression is converted to a pointer first.
There's some original vocabulary in there.
Later down this post, where you use the phrase "a class conversion",
I assume it means the same thing as "a type conversion",
or what I would just refer to as "a conversion".
The standard says:Isn't this, then, an rvalue subcontext where an rvalue expression is
What is sometimes called ??rvalue??
is in this International Standard
described as the ??value of an expression??.
Now, in this context is the rvalue expression dropped via a class
conversion to result in a void expression?
There is no context provided. 42 is just 42.
The expression statement
42;
is executed and evaluated as
(void)42;
converted to a void expression?
The classes of subcontext are not familiar to me
and I believe they are irrelevant
to the issue of expression statement evaluation.
N869Which is sort of where I ended up, along a different path.
6.8.3 Expression and null statements
Semantics
[#2] The expression in an expression statement is evaluated
as a void expression for its side effects.
Close enough
for me if I read the code as a parser (and not a lawyer).
--
pete
.
- References:
- Concept of Statements and Expressions
- From: Neroku
- Re: Concept of Statements and Expressions
- From: Vladimir Oka
- Re: Concept of Statements and Expressions
- From: Keith Thompson
- Re: Concept of Statements and Expressions
- From: void * clvrmnky()
- Re: Concept of Statements and Expressions
- From: pete
- Re: Concept of Statements and Expressions
- From: void * clvrmnky()
- Concept of Statements and Expressions
- Prev by Date: Re: A little quiz on macros
- Next by Date: Re: Ansi standard with #defines and \ character
- Previous by thread: Re: Concept of Statements and Expressions
- Next by thread: Re: Concept of Statements and Expressions
- Index(es):
Relevant Pages
|
Loading