beautypg.com

HP Integrity NonStop J-Series User Manual

Page 251

background image

register RWIsvSlink* link = head_.next_;
while (i--) link = link->next_;
return link;
}

In this code, note how the function always attempts to detect a bounds error. If it finds one, it
throws an instance of RWBoundsErr, a class that inherits from RWInternalErr. This instance
contains an internationalized message, discussed in

Chapter 16 (

Localizing Messages

)

. The

RWTHROW macro is discussed in

Chapter 19 (

Return Type of operator>>()

)

.

Throwing an exception gives you the opportunity to catch and possibly recover the exception.
However, because the internal logic of the program has been compromised, most likely you will
want to attempt to save the document you are working on, and abort the program.

This manual is related to the following products: