Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location:
Link against:

TRAPD

TRAPD(_r,_s) TInt _r;{TTrap __t;if (__t.Trap(_r)==0){_s;TTrap::UnTrap();}}

Support

Supported from 5.0

Description

Use this macro in the same way as you would TRAP, except that the variable _r is defined as part of the macro (and is therefore valid for the rest of the block in which the macro occurs). Often, this saves a line of code.

Parameters

_r

a name, which will be declared as a TInt, and will receive the result of any User::Leave() executed within _s or, if no leave occurred, it will be set to KErrNoneAfter the macro, _r remains in scope until the end of its enclosing block.

_s

C++ statements which will be executed under a trap harness.