_Pointers_and_Arrays_

Discussion in 'C Programming' started by Vijay Kumar R Zanvar, Jun 11, 2004.

  1. Vijay Kumar R Zanvar, Jun 11, 2004
    #1
    1. Advertisements

  2. Vijay Kumar R Zanvar

    Jack Klein Guest

    Only took a quick look, but:

    An lvalue can be formalized as:
    "An address in the memory that is the location of an object whose
    contents can be modified."

    Arrays are lvalues, but they cannot be modified. Ordinary objects
    defined as const and string literals are lvalues but they cannot be
    modified.

    I realize that you introduce "modifiable lvalue" a little bit later,
    but I would not use "formalized" with a vague generality which is
    incorrect in several places.

    Also, I don't much care for your definition of the term object:

    "An object is a contiguous block of memory forming a single logical
    data structure. Objects are the units of allocation, deallocation,
    etc., and has a well-defined set of operations."

    Here's what the C standard says, in two simple sentences:

    <begin quote>
    3.14
    1 object
    region of data storage in the execution environment, the contents of
    which can represent values
    2 NOTE When referenced, an object may be interpreted as having a
    particular type; see 6.3.2.1.
    <end quote>

    An object in and of itself does _not_ form a single logical data
    structure, or any structure at all. As the second sentence mentions,
    only when accessed through an lvalue does an object have a type and
    (possibly) a valid representation.
     
    Jack Klein, Jun 12, 2004
    #2
    1. Advertisements

  3. Thank you, Jack. I see that people do not have time to
    read a long story. BTW, I'll modify as you suggest. See below.
    I will change "formalized" to "defined". I will treat "lvalue" and
    "modifiable lvalue" together.
    This becomes a general definition. The C's definition of object is
    as you have mentioned. Thanks.
     
    Vijay Kumar R Zanvar, Jun 15, 2004
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.
Similar Threads
There are no similar threads yet.
Loading...