C++: destructor and delete

  • Thread starter Newsnet Customer
  • Start date
J

jeffc

Default User said:
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.
 
A

Andrey Tarasevich

jeffc said:
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.

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.
 
K

Karl Heinz Buchegger

Andrey said:
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.

But you agree that they are radically different to class objects?
 
R

Ron Natalie

jeffc said:
No, not any more than ints are objects. In the context of this discussion,

The context of the discussion is C++. int's are objects, so are pointers.
 
J

jeffc

Ron Natalie said:
discussion,

The context of the discussion is C++. int's are objects, so are
pointers.

Not good enough. There is a clear distinction between a built in type and
an instance of a class.
 
R

Ron Natalie

jeffc said:
Not good enough. There is a clear distinction between a built in type and
an instance of a class.
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.
 
J

jeffc

Ron Natalie said:
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.

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
defined, they will be created for you implicitly. Since pointers are objects
too, they will have a constructor and destructor."

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.)
 
A

Andrey Tarasevich

jeffc said:
pointers.

Not good enough. There is a clear distinction between a built in type and
an instance of a class.
...

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?
 
A

Andrey Tarasevich

jeffc said:
...
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

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.)
...

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.
 
A

Andrey Tarasevich

Karl said:
But you agree that they are radically different to class objects?

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

jeffc

Andrey Tarasevich said:
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.

I'm talking about correcting the OP, not Mr. Stroustrup.
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.

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

jeffc

Andrey Tarasevich said:
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?

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.
 
R

Ron Natalie

jeffc said:
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."

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.
I say he's wrong. If you want to argue with me about that, EOT. Otherwise
correct that statement any way you see fit.

You're right. He's wrong.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top