Structures, Pointer and gets

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joe Wright

    #16
    Re: Structures, Pointer and gets

    Thomas Stegen wrote:[color=blue]
    >
    > Joe Wright wrote:
    >[color=green]
    > > Thomas Stegen wrote:
    > >[color=darkred]
    > >>Joe Wright wrote:
    > >>
    > >>
    > >>>Yes indeed. I am of the old school that differentiates between values
    > >>>and objects. I read pointer as an object which may hold a value which is
    > >>>the address of another object. Others call an address value a pointer. I
    > >>>understand but I disagree.
    > >>
    > >>You disagree with a standard definition? Interesting... :)
    > >>[/color]
    > >
    > > Why interesting?[/color]
    >
    > Because the most you can say is that the definition is flawed.
    > A definition is, by definition, correct.
    >[color=green]
    > > Does the Standard confuse value and object? Maybe.[/color]
    >
    > It does not. Objects can have type pointer to T. Values can have type
    > pointer to T. Sheldon quoted an appropriate from the standard with which
    > you disagree (You are saying that the address of an object is not a
    > pointer.)
    >[/color]
    I agree that both objects and values can have type 'pointer to T'.
    Because a value has pointer type does not make it a pointer. From K&R2
    the first sentence of Chapter 5: reads "A pointer is a variable that
    contains the address of a variable." I know that K&R is not the Standard
    but if Kernighan and Ritchie agree on something about C, it's good
    enough for me.
    [color=blue][color=green]
    > > Let's examine two objects..
    > >
    > > char arr[10];
    > > char *arp;[/color]
    >
    > As your example demonstrates something different from what you were
    > saying I snipped most of it.
    >
    > You are saying (at least said) that arp is a pointer, whereas &arp is
    > not. Note that when arr is evaluated it is converted to a value which
    > is the address of the first element in the array. This value is not
    > stored in any object and so is by your disagreement with the standard
    > not a pointer. You just have to look at clause 6.3.2.1#2 to see that
    > this value is indeed a pointer.
    >[/color]
    I'll 'say' it again for the listening impaired. A value is not a pointer
    even if it has pointer type. The pointer is the object that holds the
    value.

    It's not just about pointers. Consider..

    int a; /* a is an object of type int */

    a = 5; /* 5 is a literal value of type int */

    Although (a == 5) is true, 5 is not an object.

    I've had this discussion before. It is clear as crystal to me. That
    others can't see it as I do truly baffles me.
    --
    Joe Wright http://www.jw-wright.com
    "Everything should be made as simple as possible, but not simpler."
    --- Albert Einstein ---

    Comment

    • Thomas Stegen

      #17
      Re: Structures, Pointer and gets

      Joe Wright wrote:
      [color=blue]
      > I've had this discussion before. It is clear as crystal to me.[/color]

      It is clear as crystal to me what you mean. It is still wrong.

      --
      Thomas.

      Comment

      • Joe Wright

        #18
        Re: Structures, Pointer and gets

        Thomas Stegen wrote:[color=blue]
        >
        > Joe Wright wrote:
        >[color=green]
        > > I've had this discussion before. It is clear as crystal to me.[/color]
        >
        > It is clear as crystal to me what you mean. It is still wrong.
        >[/color]
        Pray tell. What is 'wrong' about anything I've said here?
        --
        Joe Wright http://www.jw-wright.com
        "Everything should be made as simple as possible, but not simpler."
        --- Albert Einstein ---

        Comment

        • Thomas Stegen

          #19
          Re: Structures, Pointer and gets

          Joe Wright wrote:
          [color=blue]
          > Thomas Stegen wrote:[/color]
          [color=blue][color=green]
          >>It is clear as crystal to me what you mean. It is still wrong.
          >>[/color]
          >
          > Pray tell. What is 'wrong' about anything I've said here?[/color]

          "Others call an address value a pointer. I understand but I disagree."

          I hope I never see you talking about a function returning pointers.
          Oh and did you know that the unary & operator returns a pointer?
          The standard is very clear on the matter.

          If this is just your opinion please say so, because I am not
          interested in discussing your opinion proper, which is what we
          appear to be doing.

          --
          Thomas.

          Comment

          • Thomas Stegen

            #20
            Re: Structures, Pointer and gets

            Joe Wright wrote:
            [color=blue]
            > Thomas Stegen wrote:
            >[color=green]
            >>Joe Wright wrote:
            >>
            >>[color=darkred]
            >>>I've had this discussion before. It is clear as crystal to me.[/color]
            >>
            >>It is clear as crystal to me what you mean. It is still wrong.
            >>[/color]
            >
            > Pray tell. What is 'wrong' about anything I've said here?[/color]

            Ok, I've had a look at the standard and it does not define the
            term "pointer" at all. So saying you disagree that the unary &
            operator returns a pointer has no foundation anywhere. You even
            disagree with K&R which states at least once that function
            such and such returns a pointer to whatever. The standard also
            does this. So the consensus between the standard and K&R is that
            functions do return pointers. And the 2 other books I checked
            also does this.

            Also consider how awkward it is if only objects of type pointer
            to T can be called pointer. You cannot say that a function takes
            a pointer as an argument for example. It seems that pointer
            should be used to mean anything (object or value) that has pointer
            to T and if you want to make a distinction you use object of type
            pointer to T or value of type pointer to T.

            It certainly seems like the consensus is against you when the two
            most authorative sources available on C programming is against you.

            --
            Thomas.

            Comment

            • Joe Wright

              #21
              Re: Structures, Pointer and gets

              Thomas Stegen wrote:[color=blue]
              >
              > Joe Wright wrote:
              >[color=green]
              > > Thomas Stegen wrote:[/color]
              >[color=green][color=darkred]
              > >>It is clear as crystal to me what you mean. It is still wrong.
              > >>[/color]
              > >
              > > Pray tell. What is 'wrong' about anything I've said here?[/color]
              >
              > "Others call an address value a pointer. I understand but I disagree."
              >
              > I hope I never see you talking about a function returning pointers.
              > Oh and did you know that the unary & operator returns a pointer?
              > The standard is very clear on the matter.
              >[/color]
              Really? Functions 'return' values. Operators 'yield' values. Values
              which are addresses of objects have type 'pointer to T' but they are
              still values and not pointers. This because pointers are objects!
              [color=blue]
              > If this is just your opinion please say so, because I am not
              > interested in discussing your opinion proper, which is what we
              > appear to be doing.
              >[/color]
              Are you becoming bored with me Thomas?

              Can you give me your definition of 'pointer' which is not ambiguous? Is
              it a value or an object? Is it both? Is it neither? Straighten me out
              here.
              --
              Joe Wright http://www.jw-wright.com
              "Everything should be made as simple as possible, but not simpler."
              --- Albert Einstein ---

              Comment

              • Thomas Stegen

                #22
                Re: Structures, Pointer and gets

                Joe Wright wrote:
                [color=blue]
                > Are you becoming bored with me Thomas?[/color]

                [snip]

                Sorry about that. I didn't mean to send that article and when
                I did I tried to cancel it, but I was too late apparently. Apologies
                for that. Everything I said in that article is hereby declared null
                and void. The other article I sent a bit later is better argued and
                more decent in all respects.

                --
                Thomas.

                Comment

                • Joe Wright

                  #23
                  Re: Structures, Pointer and gets

                  Thomas Stegen wrote:[color=blue]
                  >
                  > Joe Wright wrote:
                  >[color=green]
                  > > Thomas Stegen wrote:
                  > >[color=darkred]
                  > >>Joe Wright wrote:
                  > >>
                  > >>
                  > >>>I've had this discussion before. It is clear as crystal to me.
                  > >>
                  > >>It is clear as crystal to me what you mean. It is still wrong.
                  > >>[/color]
                  > >
                  > > Pray tell. What is 'wrong' about anything I've said here?[/color]
                  >
                  > Ok, I've had a look at the standard and it does not define the
                  > term "pointer" at all. So saying you disagree that the unary &
                  > operator returns a pointer has no foundation anywhere. You even
                  > disagree with K&R which states at least once that function
                  > such and such returns a pointer to whatever. The standard also
                  > does this. So the consensus between the standard and K&R is that
                  > functions do return pointers. And the 2 other books I checked
                  > also does this.
                  >
                  > Also consider how awkward it is if only objects of type pointer
                  > to T can be called pointer. You cannot say that a function takes
                  > a pointer as an argument for example. It seems that pointer
                  > should be used to mean anything (object or value) that has pointer
                  > to T and if you want to make a distinction you use object of type
                  > pointer to T or value of type pointer to T.
                  >
                  > It certainly seems like the consensus is against you when the two
                  > most authorative sources available on C programming is against you.
                  >[/color]
                  Only two? Anyway Thomas you have been civil and a credit to our
                  community. I concede. I thank you for your interest in my proposition
                  and note (sadly) that no one else here seems interested at all. :-)

                  Via con Dios.
                  --
                  Joe Wright http://www.jw-wright.com
                  "Everything should be made as simple as possible, but not simpler."
                  --- Albert Einstein ---

                  Comment

                  • Irrwahn Grausewitz

                    #24
                    Re: Structures, Pointer and gets

                    Joe Wright <joewwright@ear thlink.net> wrote:

                    [Are addresses pointers?]
                    [color=blue]
                    > and note (sadly) that no one else here seems interested at all. :-)[/color]

                    Hmmmmmm...... ;-)

                    How about:

                    In C, variables designate objects, and objects contain values.

                    Thus we can say:

                    Pointer variables designate objects that hold pointer values.

                    Expressions that evaluate to the address of an object yield such
                    a pointer value that can be stored in objects designated by a
                    pointer variable, a la:

                    int i = 42, *p = &i;

                    where p is a pointer variable and &i is a pointer value.

                    IIRC that was the consensus in one of the last discussions about
                    this matter. A google groups search will easily bring up some
                    threads where this has been discussed.

                    Regards
                    --
                    Irrwahn
                    (irrwahn33@free net.de)

                    Comment

                    • Richard Heathfield

                      #25
                      Re: Structures, Pointer and gets

                      Joe Wright wrote:
                      [color=blue]
                      > Thomas Stegen wrote:[color=green]
                      >>
                      >> It certainly seems like the consensus is against you when the two
                      >> most authorative sources available on C programming is against you.
                      >>[/color]
                      > Only two? Anyway Thomas you have been civil and a credit to our
                      > community. I concede. I thank you for your interest in my proposition
                      > and note (sadly) that no one else here seems interested at all. :-)[/color]

                      Oh, we're interested all right. It's just that we already had this
                      discussion quite recently, so we're just watching the fireworks. :-)

                      --
                      Richard Heathfield : binary@eton.pow ernet.co.uk
                      "Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
                      C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
                      K&R answers, C books, etc: http://users.powernet.co.uk/eton

                      Comment

                      • Joe Wright

                        #26
                        Re: Structures, Pointer and gets

                        Richard Heathfield wrote:[color=blue]
                        >
                        > Joe Wright wrote:
                        >[color=green]
                        > > Thomas Stegen wrote:[color=darkred]
                        > >>
                        > >> It certainly seems like the consensus is against you when the two
                        > >> most authorative sources available on C programming is against you.
                        > >>[/color]
                        > > Only two? Anyway Thomas you have been civil and a credit to our
                        > > community. I concede. I thank you for your interest in my proposition
                        > > and note (sadly) that no one else here seems interested at all. :-)[/color]
                        >
                        > Oh, we're interested all right. It's just that we already had this
                        > discussion quite recently, so we're just watching the fireworks. :-)
                        >[/color]
                        Voyeurs? I brought this up here several years ago and Kaz shot it down.
                        I bring it up about once a year now because it really bugs me. Thanks
                        for listening.
                        --
                        Joe Wright http://www.jw-wright.com
                        "Everything should be made as simple as possible, but not simpler."
                        --- Albert Einstein ---

                        Comment

                        • Joona I Palaste

                          #27
                          [OT] Structures, Pointer and gets

                          Joe Wright <joewwright@ear thlink.net> scribbled the following:[color=blue]
                          > Via con Dios.[/color]

                          "Road with God"? Don't you mean "Vaya con Dios", "Walk with God"?

                          --
                          /-- Joona Palaste (palaste@cc.hel sinki.fi) ------------- Finland --------\
                          \-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
                          "Roses are red, violets are blue, I'm a schitzophrenic and so am I."
                          - Bob Wiley

                          Comment

                          • Joe Wright

                            #28
                            Re: [OT] Structures, Pointer and gets

                            Joona I Palaste wrote:[color=blue]
                            >
                            > Joe Wright <joewwright@ear thlink.net> scribbled the following:[color=green]
                            > > Via con Dios.[/color]
                            >
                            > "Road with God"? Don't you mean "Vaya con Dios", "Walk with God"?
                            >[/color]
                            Yes, of course.
                            --
                            Joe Wright http://www.jw-wright.com
                            "Everything should be made as simple as possible, but not simpler."
                            --- Albert Einstein ---

                            Comment

                            Working...