what c++ standard says?

Discussion in 'C++' started by toton, Feb 26, 2007.

  1. toton

    toton Guest

    Hi,
    Here are a few of my questions, just to know what C++ standard says
    (I don't have a standard manual :( ) , not the platform specific task.
    May be an one liner answer (even one word answer ) is good.
    1) Is RTTI (i.e dynamic_cast etc ) are optional , like as in MSVC it
    need to be enabled, or always present.
    2) what is type of char (and wchar_t) signed or unsigned ?
    3) size_t is in namespace std or may be outsize also (in C++, not in
    C) . Which header defines it in standard (i.e which header always
    defines it)
     
    toton, Feb 26, 2007
    #1
    1. Advertising

  2. * toton:
    > Hi,
    > Here are a few of my questions, just to know what C++ standard says
    > (I don't have a standard manual :( ) , not the platform specific task.
    > May be an one liner answer (even one word answer ) is good.
    > 1) Is RTTI (i.e dynamic_cast etc ) are optional , like as in MSVC it
    > need to be enabled, or always present.


    RTTI support isn't optional for standard C++.


    > 2) what is type of char (and wchar_t) signed or unsigned ?


    Implementation dependent. Use e.g. 'unsigned char' where you need a
    particular signedness.


    > 3) size_t is in namespace std or may be outsize also (in C++, not in
    > C) . Which header defines it in standard (i.e which header always
    > defines it)


    IIRC, <cstddef>.

    --
    A: Because it messes up the order in which people normally read text.
    Q: Why is it such a bad thing?
    A: Top-posting.
    Q: What is the most annoying thing on usenet and in e-mail?
     
    Alf P. Steinbach, Feb 26, 2007
    #2
    1. Advertising

  3. toton

    Kai-Uwe Bux Guest

    toton wrote:

    > Hi,
    > Here are a few of my questions, just to know what C++ standard says
    > (I don't have a standard manual :( ) , not the platform specific task.
    > May be an one liner answer (even one word answer ) is good.
    > 1) Is RTTI (i.e dynamic_cast etc ) are optional , like as in MSVC it
    > need to be enabled, or always present.


    Not optional.

    > 2) what is type of char (and wchar_t) signed or unsigned ?


    There are three distinct types:

    char
    signed char
    unsigned char

    The type signed char is signed, the type unsigned char is unsigned, and the
    type char is required to have the same set of values and the same value
    representation as one of the other types. Which one is implementation
    defined. Sometimes you can choose through a compiler switch.


    As for wchar_t, the standard says [3.9.1]

    Type wchar_t is a distinct type whose values can represent distinct codes
    for all members of the largest extended character set specified among the
    supported locales (22.1.1). Type wchar_t shall have the same size,
    signedness, and alignment requirements (3.9) as one of the other integral
    types, called its underlying type.


    > 3) size_t is in namespace std or may be outsize also (in C++, not in C) .
    > Which header defines it in standard (i.e which header always defines it)


    <cstddef> puts size_t in namespace std; and <stddef.h> put it in global
    namespace.


    Best

    Kai-Uwe Bux
     
    Kai-Uwe Bux, Feb 26, 2007
    #3
  4. toton

    toton Guest

    On Feb 26, 1:34 pm, Kai-Uwe Bux <> wrote:
    > toton wrote:
    > > Hi,
    > > Here are a few of my questions, just to know what C++ standard says
    > > (I don't have a standard manual :( ) , not the platform specific task.
    > > May be an one liner answer (even one word answer ) is good.
    > > 1) Is RTTI (i.e dynamic_cast etc ) are optional , like as in MSVC it
    > > need to be enabled, or always present.

    >
    > Not optional.
    >
    > > 2) what is type of char (and wchar_t) signed or unsigned ?

    >
    > There are three distinct types:
    >
    > char
    > signed char
    > unsigned char
    >
    > The type signed char is signed, the type unsigned char is unsigned, and the
    > type char is required to have the same set of values and the same value
    > representation as one of the other types. Which one is implementation
    > defined. Sometimes you can choose through a compiler switch.
    >
    > As for wchar_t, the standard says [3.9.1]
    >
    > Type wchar_t is a distinct type whose values can represent distinct codes
    > for all members of the largest extended character set specified among the
    > supported locales (22.1.1). Type wchar_t shall have the same size,
    > signedness, and alignment requirements (3.9) as one of the other integral
    > types, called its underlying type.
    >
    > > 3) size_t is in namespace std or may be outsize also (in C++, not in C) .
    > > Which header defines it in standard (i.e which header always defines it)

    >
    > <cstddef> puts size_t in namespace std; and <stddef.h> put it in global
    > namespace.
    >
    > Best
    >
    > Kai-Uwe Bux


    Thanks to both of you for answering precisely what I needed.
    And thanks to the newsgroup.

    abir
     
    toton, Feb 26, 2007
    #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. walala
    Replies:
    3
    Views:
    4,405
    Renaud Pacalet
    Oct 3, 2003
  2. Jason Shohet
    Replies:
    1
    Views:
    499
    William F. Robertson, Jr.
    Aug 1, 2003
  3. KK
    Replies:
    1
    Views:
    436
    thoean
    Sep 8, 2003
  4. Chad
    Replies:
    3
    Views:
    439
    Kevin Spencer
    Jan 12, 2004
  5. Norman Fritag
    Replies:
    2
    Views:
    908
    Paul Lynch
    Feb 18, 2004
Loading...

Share This Page