User's Guide
6 Standardizing Your Code
HP aC++ largely conforms to the ISO/IEC 14882 Standard for the C++ Programming Language
(the international standard for C++). This chapter discusses the following topics:
• “HP aC++ Keywords” (page 138)
• “Overloading new[] and delete[] for Arrays” (page 150)
• “Standard Exception Classes” (page 152)
• “Exceptions Thrown by the Standard C++ Library” (page 153)
• “type_info Class” (page 153)
• “Unsupported Functionality” (page 154)
HP aC++ Keywords
HP aC++ supports the following list of keywords. Keywords cannot be abbreviated and must
always be entered in lowercase letters.
Table 10 HP aC++ Keywords
• static_cast• friend• and
• and_eq • template• inline
• mutable• bitand • this
• throw• namespace• bitor
• bool • true• new
• not• catch • try
• typeid• not_eq• class
• compl • typename• operator
• or• const (also an ANSI C keyword) • using
• virtual• or_eq• const_cast
• delete • volatile (also an ANSI C keyword)• private
• protected• dynamic_cast • wchar_t
• xor• public• explicit
• ••false xor_eqreinterpret_cast
bool Keyword
The keyword bool represents a data type. Variables and expressions of type bool can have a
value of either true or false. The value of true equals 1. The value of false equals 0.
Usage
The ANSI/ISO C++ International Standard states that values of type bool are either true or
false. There are no signed, unsigned, short, or long bool types or values. bool values behave
as integral types and participate in integral promotions. Types bool, char, wchar_t, and the
signed and unsigned integer types are collectively called integral types. A synonym for integral
type is integer type. The representations of integral types shall define values by use of a pure binary
numeration system.
Example
int main(){
bool b=true; // Declare a variable of type bool and set it to true.
if (b) // Test value of bool variable.
138 Standardizing Your Code