_Pointers_and_Arrays_

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Vijay Kumar R Zanvar

    #1

    _Pointers_and_Arrays_

    Hello clc!

    In short, this one is in search of some criticism:

    Text: http://geocities.com/vijoeyz/articles/c/pna/pna.txt
    HTML: http://geocities.com/vijoeyz/articles/c/pna/

    Thanks.

    Vijay
    --
    PS: I'll be out of station for coming four days.


  • Jack Klein

    #2
    Re: _Pointers_and_A rrays_

    On Fri, 11 Jun 2004 17:06:33 +0530, "Vijay Kumar R Zanvar"
    <vijoeyz@global edgesoft.com> wrote in comp.lang.c:
    [color=blue]
    > Hello clc!
    >
    > In short, this one is in search of some criticism:
    >
    > Text: http://geocities.com/vijoeyz/articles/c/pna/pna.txt
    > HTML: http://geocities.com/vijoeyz/articles/c/pna/
    >
    > Thanks.
    >
    > Vijay[/color]

    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
    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++

    Comment

    • Vijay Kumar R Zanvar

      #3
      Re: _Pointers_and_A rrays_


      "Jack Klein" <jackklein@spam cop.net> wrote in message news:pspkc0pva4 o3nm3uvf6l7v731 anlc5et12@4ax.c om...[color=blue]
      > On Fri, 11 Jun 2004 17:06:33 +0530, "Vijay Kumar R Zanvar"
      > <vijoeyz@global edgesoft.com> wrote in comp.lang.c:
      >[color=green]
      > > Hello clc!
      > >
      > > In short, this one is in search of some criticism:
      > >
      > > Text: http://geocities.com/vijoeyz/articles/c/pna/pna.txt
      > > HTML: http://geocities.com/vijoeyz/articles/c/pna/
      > >
      > > Thanks.
      > >
      > > Vijay[/color][/color]

      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.
      [color=blue]
      > 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.[/color]

      I will change "formalized " to "defined". I will treat "lvalue" and
      "modifiable lvalue" together.
      [color=blue]
      > 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."
      >[/color]

      This becomes a general definition. The C's definition of object is
      as you have mentioned. Thanks.
      [color=blue]
      > 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
      > 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[/color]


      Comment

      Working...