Are Built-in Data Types also Classes

Discussion in 'C++' started by lovecreatesbeauty, Sep 8, 2005.

  1. 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.
     
    lovecreatesbeauty, Sep 8, 2005
    #1
    1. Advertising

  2. 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
     
    Victor Bazarov, Sep 8, 2005
    #2
    1. Advertising

  3. lovecreatesbeauty

    Ron Natalie Guest

    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.
     
    Ron Natalie, Sep 8, 2005
    #3
  4. lovecreatesbeauty

    Mike Wahler Guest

    "Ron Natalie" <> wrote in message
    news:4320a309$0$5732$...
    > 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
     
    Mike Wahler, Sep 9, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Martelli
    Replies:
    3
    Views:
    300
    Achim Dahlhoff
    Nov 29, 2005
  2. ramu
    Replies:
    2
    Views:
    328
    rlblaster
    Feb 20, 2006
  3. Alona
    Replies:
    2
    Views:
    653
  4. CC
    Replies:
    1
    Views:
    238
    Scott David Daniels
    Aug 20, 2007
  5. Gary Roach
    Replies:
    0
    Views:
    114
    Gary Roach
    Sep 1, 2013
Loading...

Share This Page