]>
git.saurik.com Git - wxWidgets.git/blob - interface/scopeguard.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of global functions
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
11 This family of macros is similar to wxON_BLOCK_EXIT()
12 but calls a method of the given object instead of a free function.
14 wxON_BLOCK_EXIT_OBJ0(obj
, method
);
15 wxON_BLOCK_EXIT_OBJ1(obj
, method
, p1
);
16 wxON_BLOCK_EXIT_OBJ2(obj
, method
, p1
, p2
);
22 This family of macros allows to ensure that the global function @e func
23 with 0, 1, 2 or more parameters (up to some implementaton-defined limit) is
24 executed on scope exit, whether due to a normal function return or because an
25 exception has been thrown. A typical example of its usage:
28 void *buf = malloc(size);
29 wxON_BLOCK_EXIT1(free, buf);
32 Please see the original article by Andrei Alexandrescu and Petru Marginean
33 published in December 2000 issue of C/C++ Users Journal for more
36 @see wxON_BLOCK_EXIT_OBJ()
38 wxON_BLOCK_EXIT0(func
);
39 wxON_BLOCK_EXIT1(func
, p1
);
40 wxON_BLOCK_EXIT2(func
, p1
, p2
);