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

and

friend

static_cast

and_eq

inline

template

bitand

mutable

this

bitor

namespace

throw

bool

new

true

catch

not

try

class

not_eq

typeid

compl

operator

typename

const (also an ANSI C keyword)

or

using

const_cast

or_eq

virtual

delete

private

volatile (also an ANSI C keyword)

dynamic_cast

protected

wchar_t

explicit

public

xor

false

reinterpret_cast

xor_eq

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

Page 138
Image 138
HP C/aC++ for PA-RISC Software manual Standardizing Your Code, HP aC++ Keywords, Bool Keyword