Macro is a rule or pattern that specifies how a certain input sequence should be mapped to an output sequence according to a defined procedure. This tutorial describes the OR_LEAVE macro and provides details on how the OR_LEAVE macro should be used.
Before beginning you must know the following:
The OR_LEAVE macro is a convenience macro that allows the developer to deemphasize auxiliary error checking code in most cases. It is a postfix macro which implements User::LeaveIfError() on an integer return type. This means that there is less focus on the error handling code and makes the code easier to read.
The OR_LEAVE macro is defined as a postfix operator. An example code snippet is shown below:
#define OR_LEAVE || Eleave inline void operator||(Tint aStatus, Tleave /*aTag*/) { User::LeaveIfError(aStatus); }
It is a postfix macro which implements User::LeaveIfError() function on an integer return type. This means that there is less focus on the error handling code and makes the code easier to read.
The OR_LEAVE is used to replace a call to User::LeaveIfError() function. An example code snippet is shown below:
User::LeaveIfError(iTimer->CreateLocal());
The call to iTimer->CreateLocal() is included within the error handling code User::LeaveIfError() function and is difficult to read. The following fragment uses the OR_LEAVE macro.
iTimer->CreateLocal() OR_LEAVE;
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.