C++: destructor and delete

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ron Natalie

    #46
    Re: destructor and delete


    "jeffc" <nobody@nowhere .com> wrote in message news:3f560227_2 @news1.prserv.n et...
    ..[color=blue]
    >
    > Not good enough. There is a clear distinction between a built in type and
    > an instance of a class.
    >[/color]
    There is. But they are both, as far as C++ is concerned, objects.
    Object is a term defined in the language as "a region of storage."
    It is essentially any "data" code (that is, functions and pieces thereof)
    are not objects, everything else is.

    Objects are NOT limitted to classes.


    Comment

    • jeffc

      #47
      Re: destructor and delete


      "Ron Natalie" <ron@sensor.com > wrote in message
      news:3f561a17$0 $23199$9a6e19ea @news.newshosti ng.com...[color=blue]
      >
      > "jeffc" <nobody@nowhere .com> wrote in message[/color]
      news:3f560227_2 @news1.prserv.n et...[color=blue]
      > .[color=green]
      > >
      > > Not good enough. There is a clear distinction between a built in type[/color][/color]
      and[color=blue][color=green]
      > > an instance of a class.
      > >[/color]
      > There is. But they are both, as far as C++ is concerned, objects.
      > Object is a term defined in the language as "a region of storage."
      > It is essentially any "data" code (that is, functions and pieces thereof)
      > are not objects, everything else is.
      >
      > Objects are NOT limitted to classes.[/color]

      Fine Ron, be pedantic if you insist. Stroustrup calls that a "simple and
      low-level notion of an object" and warns not to confuse it with the notion
      of a class object, which is what you've done - confuse things. Here's the
      original quote from the OP:

      "> An object will always have a constructor and a destructor. If either is
      not[color=blue]
      > defined, they will be created for you implicitly. Since pointers are[/color]
      objects[color=blue]
      > too, they will have a constructor and destructor."[/color]

      You go ahead and correct him and I'm sure you can come up with something
      better than I did (I'm at a loss as to why you'd argue with my reply, rather
      than with his statement.)


      Comment

      • Andrey Tarasevich

        #48
        Re: destructor and delete

        jeffc wrote:[color=blue][color=green][color=darkred]
        >> > >
        >> > > > Pointers are not objects.
        >> > >
        >> > > Sure they are. They just aren't objects of the type they point to.
        >> >
        >> > No, not any more than ints are objects. In the context of this[/color][/color]
        > discussion,[color=green]
        >>
        >> The context of the discussion is C++. int's are objects, so are[/color]
        > pointers.
        >
        > Not good enough. There is a clear distinction between a built in type and
        > an instance of a class.
        > ...[/color]

        Yes, there is. But I don't see how it is supposed to prove your point.
        You were talking about "objects". Now your are talking about "built-in
        types" and "instances of a class". Where is the connection?

        --
        Best regards,
        Andrey Tarasevich
        Brainbench C and C++ Programming MVP

        Comment

        • Andrey Tarasevich

          #49
          Re: destructor and delete

          jeffc wrote:[color=blue]
          > ...
          > Fine Ron, be pedantic if you insist. Stroustrup calls that a "simple and
          > low-level notion of an object" and warns not to confuse it with the notion
          > of a class object, which is what you've done - confuse things. Here's the
          > original quote from the OP:
          >
          > "> An object will always have a constructor and a destructor. If either is
          > not[color=green]
          >> defined, they will be created for you implicitly. Since pointers are[/color]
          > objects[color=green]
          >> too, they will have a constructor and destructor."[/color]
          >
          > You go ahead and correct him and I'm sure you can come up with something
          > better than I did (I'm at a loss as to why you'd argue with my reply, rather
          > than with his statement.)
          > ...[/color]

          It's been said many times here and in many other places, that TC++PL
          book uses alternative non-standard terminology. Formally speaking, from
          the standard C++ point of view, the above statement and a number of
          other statements made in TC++PL are _completely_ _incorrect_.

          It is not a matter of "correcting " or "not correcting" Mr. Stroustrup.
          It is a matter of understanding that the author probably had his reasons
          to deviate from the standard terminology. It should be kept in mind when
          reading the book.

          This forum, by default, uses the standard terminology. If you prefer to
          use the one from TC++PL, you should accompany you messages with the
          corresponding remark, to avoid unnecessary confusion.

          --
          Best regards,
          Andrey Tarasevich
          Brainbench C and C++ Programming MVP

          Comment

          • Andrey Tarasevich

            #50
            Re: destructor and delete

            Karl Heinz Buchegger wrote:[color=blue][color=green][color=darkred]
            >> >> ...
            >> >> > Pointers are not objects.
            >> >>
            >> >> Sure they are. They just aren't objects of the type they point to.
            >> >
            >> > No, not any more than ints are objects. In the context of this discussion,
            >> > that ain't happenin'. No one mentioned "smart pointers" or anything fancy,
            >> > either.[/color]
            >>
            >> It looks like your idea of an "object" is significantly different from
            >> the standard meaning of the term "object" in C++. Ints are objects.
            >> Pointers are objects too.[/color]
            >
            > But you agree that they are radically different to class objects?[/color]

            Of course, I do. If by "class objects" you mean "class instances" or
            "objects of class type".

            --
            Best regards,
            Andrey Tarasevich
            Brainbench C and C++ Programming MVP

            Comment

            • jeffc

              #51
              Re: destructor and delete


              "Andrey Tarasevich" <andreytarasevi ch@hotmail.com> wrote in message
              news:vlcafp9veq 73a@news.supern ews.com...[color=blue]
              > jeffc wrote:[color=green]
              > > ...
              > > Fine Ron, be pedantic if you insist. Stroustrup calls that a "simple[/color][/color]
              and[color=blue][color=green]
              > > low-level notion of an object" and warns not to confuse it with the[/color][/color]
              notion[color=blue][color=green]
              > > of a class object, which is what you've done - confuse things. Here's[/color][/color]
              the[color=blue][color=green]
              > > original quote from the OP:
              > >
              > > "> An object will always have a constructor and a destructor. If either[/color][/color]
              is[color=blue][color=green]
              > > not[color=darkred]
              > >> defined, they will be created for you implicitly. Since pointers are[/color]
              > > objects[color=darkred]
              > >> too, they will have a constructor and destructor."[/color]
              > >
              > > You go ahead and correct him and I'm sure you can come up with something
              > > better than I did (I'm at a loss as to why you'd argue with my reply,[/color][/color]
              rather[color=blue][color=green]
              > > than with his statement.)
              > > ...[/color]
              >
              > It's been said many times here and in many other places, that TC++PL
              > book uses alternative non-standard terminology. Formally speaking, from
              > the standard C++ point of view, the above statement and a number of
              > other statements made in TC++PL are _completely_ _incorrect_.
              >
              > It is not a matter of "correcting " or "not correcting" Mr. Stroustrup.[/color]

              I'm talking about correcting the OP, not Mr. Stroustrup.
              [color=blue]
              > This forum, by default, uses the standard terminology. If you prefer to
              > use the one from TC++PL, you should accompany you messages with the
              > corresponding remark, to avoid unnecessary confusion.[/color]

              Standard OO terminology is not unclear on the meaning of "object".


              Comment

              • jeffc

                #52
                Re: destructor and delete


                "Andrey Tarasevich" <andreytarasevi ch@hotmail.com> wrote in message
                news:vlca2n6grr 7t50@news.super news.com...[color=blue]
                >
                > Yes, there is. But I don't see how it is supposed to prove your point.
                > You were talking about "objects". Now your are talking about "built-in
                > types" and "instances of a class". Where is the connection?[/color]

                I really don't know what bone you guys are trying to pick. The original
                poster wrote
                "An object will always have a constructor and a destructor. If either is not
                defined, they will be created for you implicitly. Since pointers are objects
                too, they will have a constructor and destructor."

                I say he's wrong. If you want to argue with me about that, EOT. Otherwise
                correct that statement any way you see fit.


                Comment

                • Ron Natalie

                  #53
                  Re: destructor and delete


                  "jeffc" <nobody@nowhere .com> wrote in message news:3f563af9_4 @news1.prserv.n et...
                  [color=blue]
                  > I really don't know what bone you guys are trying to pick. The original
                  > poster wrote
                  > "An object will always have a constructor and a destructor. If either is not
                  > defined, they will be created for you implicitly. Since pointers are objects
                  > too, they will have a constructor and destructor."[/color]

                  As far as the C++ standard goes, the only thing that is right above is that
                  pointers are objects. Objects do not necessarily have constructors and destructors.
                  Only classes have them, pointers and other non-class types do not.
                  [color=blue]
                  >
                  > I say he's wrong. If you want to argue with me about that, EOT. Otherwise
                  > correct that statement any way you see fit.[/color]

                  You're right. He's wrong.


                  Comment

                  Working...