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

what c++ standard says?

P: n/a
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)

Feb 26 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
* 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?
Feb 26 '07 #2

P: n/a
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)
<cstddefputs size_t in namespace std; and <stddef.hput it in global
namespace.
Best

Kai-Uwe Bux
Feb 26 '07 #3

P: n/a
On Feb 26, 1:34 pm, Kai-Uwe Bux <jkherci...@gmx.netwrote:
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)

<cstddefputs size_t in namespace std; and <stddef.hput 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

Feb 26 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.