what c++ standard says?

T

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

Alf P. Steinbach

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

Kai-Uwe Bux

toton said:
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
 
T

toton

toton said:
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
 

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

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top