value context

R

Richard Heathfield

(e-mail address removed), India said:
What is meant by value context ?

It is not a formal term. When people on this newsgroup use it, they
generally mean:

(a) we're not talking declaration or definition of the object in
question, AND
(c) we're not talking assignment TO the object, AND
(c) we're not talking sizeof, AND
(d) we're not talking &.

Just about all that remains is the use of the name of an object to
indicate that we want to read its value. This is important for arrays:

int foo[] = { 1, 2, 3 }; /* not a value context for foo */
size_t s = sizeof foo; /* not a value context for foo */
int (*ap)[3] = &foo; /* not a value context for foo */
int *ip = foo; /* this *is* a value context */
I could not find the definition for value context in

www.open-std.org.jtc1.sc22.wg14.www.docs.n1124.pdf

Right. It is not a formal term. It's just something that everybody knows
(except for those who don't know, of course - which is why asking
questions is such a good idea).
 
K

Keith Thompson

Richard Heathfield said:
(e-mail address removed), India said:
What is meant by value context ?

It is not a formal term. When people on this newsgroup use it, they
generally mean:

(a) we're not talking declaration or definition of the object in
question, AND
(c) we're not talking assignment TO the object, AND
(c) we're not talking sizeof, AND
(d) we're not talking &.

Just about all that remains is the use of the name of an object to
indicate that we want to read its value. This is important for arrays:

int foo[] = { 1, 2, 3 }; /* not a value context for foo */
size_t s = sizeof foo; /* not a value context for foo */
int (*ap)[3] = &foo; /* not a value context for foo */
int *ip = foo; /* this *is* a value context */
I could not find the definition for value context in

www.open-std.org.jtc1.sc22.wg14.www.docs.n1124.pdf

Right. It is not a formal term. It's just something that everybody knows
(except for those who don't know, of course - which is why asking
questions is such a good idea).

And to describe it using a formal term that *is* found in the
standard, a value context is an expression context that doesn't
require an lvalue.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top