By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,501 Members | 1,660 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,501 IT Pros & Developers. It's quick & easy.

Are Built-in Data Types also Classes

P: n/a
Prof. Bjarne Stroustrup said "built-in data types have default
constructor" at 10.4.2 in `TC++PL, special ed.'.

He also said that "built-in data types are not classes" at 11.4 in
`TC++PL, special ed.'.

(Sorry, I'm reading a Chinese edition of the book, and can't get a
English edition handy currently. Perhaps these words are not same as
his book, but I think the meaning is the same.)

Can I take Built-in Data Types as Compiler Defined Types. Then it's the
same as class (UDT) at this point.

Sep 8 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
lovecreatesbeauty wrote:
Prof. Bjarne Stroustrup said "built-in data types have default
constructor" at 10.4.2 in `TC++PL, special ed.'.
Yes, _syntactically_ and _semantically_, not *literally*.
He also said that "built-in data types are not classes" at 11.4 in
`TC++PL, special ed.'.
Yes.
(Sorry, I'm reading a Chinese edition of the book, and can't get a
English edition handy currently. Perhaps these words are not same as
his book, but I think the meaning is the same.)
Pretty much. I don't have my copy of the SE handy either, but I am
certain that you quote it correctly.
Can I take Built-in Data Types as Compiler Defined Types. Then it's
the same as class (UDT) at this point.


What do you mean by "can I take"? The important difference is that
the built-in types (a) have some conversions defined that are implicit
and (b) have predefined operators that cannot be redefined and (c)
have no member functions. The similarity is only in two areas: the
built-in types can be "constructed" using syntax "type()", and there
is a "pseudo-destrutor call" defined for them, like "~int()". Those
things were added to them so that they can be used with templates,
IIUIC.

V
Sep 8 '05 #2

P: n/a
lovecreatesbeauty wrote:
Prof. Bjarne Stroustrup said "built-in data types have default
constructor" at 10.4.2 in `TC++PL, special ed.'.
Doesn't say that in the English version. However the English text
is pretty much WRONG and always has been wrong for C++. Not even
all class types work the way he describes due to the woefully
stupid decision of forgetting to default initialize pod types.

He also said that "built-in data types are not classes" at 11.4 in
`TC++PL, special ed.'.
Correct, they are not.

Can I take Built-in Data Types as Compiler Defined Types. Then it's the
same as class (UDT) at this point.

No, on a number of points.
Sep 8 '05 #3

P: n/a

"Ron Natalie" <ro*@spamcop.net> wrote in message
news:43**********************@news.newshosting.com ...
lovecreatesbeauty wrote:
Prof. Bjarne Stroustrup said "built-in data types have default
constructor" at 10.4.2 in `TC++PL, special ed.'.


Doesn't say that in the English version. However the English text
is pretty much WRONG and always has been wrong for C++. Not even
all class types work the way he describes due to the woefully
stupid decision of forgetting to default initialize pod types.


Someone *decided* to *forget*? Hmmm. :-)

-Mike
Sep 9 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.