473,569 Members | 2,472 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

lvalues -> incomplete types

An lvalue is an expression with an object type or
an incomplete type other than void;53)
if an lvalue does not designate an object when
it is evaluated, the behavior is undefined.

When would one ever use an incomplete type
as an lvalue?

--
nethlek
Nov 14 '05 #1
7 1738
Mantorok Redgormor wrote:

An lvalue is an expression with an object type or
an incomplete type other than void;53)
if an lvalue does not designate an object when
it is evaluated, the behavior is undefined.

When would one ever use an incomplete type
as an lvalue?


An lvalue isn't how you use an expression.
An lvalue is a kind of expression.

x = y; /* Two lvalues */

--
pete
Nov 14 '05 #2
pete wrote:
Mantorok Redgormor wrote:

An lvalue is an expression with an object type or
an incomplete type other than void;53)
if an lvalue does not designate an object when
it is evaluated, the behavior is undefined.

When would one ever use an incomplete type
as an lvalue?


An lvalue isn't how you use an expression.
An lvalue is a kind of expression.

x = y; /* Two lvalues */


Which expressions have incomplete type (other than void) and don't
violate a constraint?

Jeremy.
Nov 14 '05 #3
Jeremy Yallop wrote:

pete wrote:
Mantorok Redgormor wrote:

An lvalue is an expression with an object type or
an incomplete type other than void;53)
if an lvalue does not designate an object when
it is evaluated, the behavior is undefined.

When would one ever use an incomplete type
as an lvalue?


An lvalue isn't how you use an expression.
An lvalue is a kind of expression.

x = y; /* Two lvalues */


Which expressions have incomplete type (other than void) and don't
violate a constraint?


/* BEGIN new.c */

#include <stdio.h>

extern int array[];

int main(void)
{
int x;

x = array[5000];
return 0;
}

/* END new.c */

--
pete
Nov 14 '05 #4
pete wrote:

Mantorok Redgormor wrote:

An lvalue is an expression with an object type or
an incomplete type other than void;53)
if an lvalue does not designate an object when
it is evaluated, the behavior is undefined.

When would one ever use an incomplete type
as an lvalue?


An lvalue isn't how you use an expression.
An lvalue is a kind of expression.

x = y; /* Two lvalues */

No. Only x might be an lvalue. y is an rvalue.
--
Joe Wright http://www.jw-wright.com
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Nov 14 '05 #5
On Fri, 06 Feb 2004 23:49:28 GMT, Joe Wright
<jo********@ear thlink.net> wrote in comp.lang.c:
pete wrote:

Mantorok Redgormor wrote:

An lvalue is an expression with an object type or
an incomplete type other than void;53)
if an lvalue does not designate an object when
it is evaluated, the behavior is undefined.

When would one ever use an incomplete type
as an lvalue?


An lvalue isn't how you use an expression.
An lvalue is a kind of expression.

x = y; /* Two lvalues */

No. Only x might be an lvalue. y is an rvalue.


Assuming y is the name of an object of a type that is assignment
convertible to the type of x, rather than a macro or enumerated
constant, than y in this expression is most certainly an lvalue.

The assignment statement performs "lvalue to value" conversion,
by accessing the value of the object. The result of this conversion
is a pure value, and no longer an lvalue, but that does not mean that
y itself is not an lvalue.

Note also that this used to be called "lvalue to rvalue" conversion,
but the term "rvalue" is no longer used in the current C standard
except for a footnote that this formerly used term has been replaced
by the phrase "value of an expression".

Here's the actual quote from 6.3.2.1 Lvalues, arrays, and function
designators, paragraph 2, of the current C standard:

"Except when it is the operand of the sizeof operator, the unary &
operator, the ++ operator, the -- operator, or the left operand of the
.. operator or an assignment operator, an lvalue that does not have
array type is converted to the value stored in the designated
object (and is no longer an lvalue). If the lvalue has qualified type,
the value has the unqualified version of the type of the lvalue;
otherwise, the value has the type of the lvalue. If the lvalue has an
incomplete type and does not have array type, the behavior is
undefined."

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.l earn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 14 '05 #6
Jack Klein wrote:

On Fri, 06 Feb 2004 23:49:28 GMT, Joe Wright
<jo********@ear thlink.net> wrote in comp.lang.c:
pete wrote:

Mantorok Redgormor wrote:
>
> An lvalue is an expression with an object type or
> an incomplete type other than void;53)
> if an lvalue does not designate an object when
> it is evaluated, the behavior is undefined.
>
> When would one ever use an incomplete type
> as an lvalue?

An lvalue isn't how you use an expression.
An lvalue is a kind of expression.

x = y; /* Two lvalues */

No. Only x might be an lvalue. y is an rvalue.


Assuming y is the name of an object of a type that is assignment
convertible to the type of x, rather than a macro or enumerated
constant, than y in this expression is most certainly an lvalue.

The assignment statement performs "lvalue to value" conversion,
by accessing the value of the object. The result of this conversion
is a pure value, and no longer an lvalue, but that does not mean that
y itself is not an lvalue.

Note also that this used to be called "lvalue to rvalue" conversion,
but the term "rvalue" is no longer used in the current C standard
except for a footnote that this formerly used term has been replaced
by the phrase "value of an expression".

Here's the actual quote from 6.3.2.1 Lvalues, arrays, and function
designators, paragraph 2, of the current C standard:

"Except when it is the operand of the sizeof operator, the unary &
operator, the ++ operator, the -- operator, or the left operand of the
. operator or an assignment operator, an lvalue that does not have
array type is converted to the value stored in the designated
object (and is no longer an lvalue). If the lvalue has qualified type,
the value has the unqualified version of the type of the lvalue;
otherwise, the value has the type of the lvalue. If the lvalue has an
incomplete type and does not have array type, the behavior is
undefined."

Ok Jack, thanks. Aren't standards wonderful? In the old days, "An object
is a manipulatable region of storage; an lvalue is an expression
referring to an object." Short and sweet. Thanks again.
--
Joe Wright http://www.jw-wright.com
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Nov 14 '05 #7
Joe Wright wrote:
Ok Jack, thanks. Aren't standards wonderful?
In the old days, "An object
is a manipulatable region of storage; an lvalue is an expression
referring to an object." Short and sweet.


A dereferenced pointer to object type, is also an lvalue.
That's the kind of lvalue, which gives undefined behavior,
if it doesn't refer to an object when evaluated.
But, they've kept the word "dereferenc ed" out of the standard, so far.

--
pete
Nov 14 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1174
by: Stefan Slapeta | last post by:
Hi, please could anybody check if this defect is fixed in whidbey? struct X { X() {} X(X& x) {}
23
3933
by: steve.j.donovan | last post by:
Hi guys, We have the following macro: #define NEXT(type,p) (*((type*)(p))++) It provides a way to poke variable sized data into an array of pcode for a simple VM. e.g,
3
2717
by: ramasubramanian.rahul | last post by:
i was reading soemthing about Lvalues Rvalues and modifiable Lvalues.... i am confused now... like for eg int *y , x ; y = &x ; in the second is x a lvalue or rvalue any pointers on some good reading on lvalues and rvalues on the web ?? thanks in advance Kind Regard
61
2753
by: jacob navia | last post by:
Continuing the discussion about casts, I would like to know your opinions about the hairy subject of casts as lvalues, i.e. This will fail under lcc-win32, but MSVC and gcc will accept it. I know that the standard prescribes the behavior that lcc-win32 uses, but I left that behavior after a big discussion about this several years ago. I...
0
7618
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7679
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6287
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3657
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
946
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.