Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Are Built-in Data Types also Classes

Reply
Thread Tools

Are Built-in Data Types also Classes

 
 
lovecreatesbeauty
Guest
Posts: n/a
 
      09-08-2005
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.

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      09-08-2005
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


 
Reply With Quote
 
 
 
 
Ron Natalie
Guest
Posts: n/a
 
      09-08-2005
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.
 
Reply With Quote
 
Mike Wahler
Guest
Posts: n/a
 
      09-09-2005

"Ron Natalie" <(E-Mail Removed)> wrote in message
news:4320a309$0$5732$(E-Mail Removed) ...
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
types of classes in template classes lobequadrat@googlemail.com C++ 5 04-27-2007 05:33 PM
Re: UPDATE: They didn't only pledge allegiance to Mex flag: anchor babies in TX *also* shouted "RAZA! RAZA!" in US school also tedorn44@hotmail.com Digital Photography 9 10-21-2006 11:12 AM
equivalent c data types for vc++ data types ramu C Programming 2 02-20-2006 09:33 AM
OOP casting classes (using one single variable for similar types of classes) roberts.noah@gmail.com C++ 8 01-07-2006 04:13 PM



Advertisments