Macros in Symbian
This article provides an overview of the more important macros used in Symbian C++ code.
Article Metadata
Contents |
__UHEAP_XXXXXX
This are the heap checking macros,which can be used to check that you are not leaking any memory under normal conditions and others that can be used to simulate out-of-memory (OOM) conditions.
__UHEAP_MARK
Marks the start of checking the current thread's heap. This macro is defined only for debug builds.
__UHEAP_MARKEND
Marks the end of checking the current thread's heap. The macro expects zero heap cells to remain allocated at the current nest level. This macro is defined only for debug builds. This macro must match an earlier call to __UHEAP_MARK.
__UHEAP_MARKENDC
Marks the end of checking the current thread's heap. The macro expects aCount heap cells to remain allocated at the current nest level. This macro must match an earlier call to __UHEAP_MARK.
__UHEAP_FAILNEXT
Simulates heap allocation failure for the current thread's heap. The failure occurs on the next call to new or any of the functions which allocate memory from the heap. This macro is defined only for debug builds.
__UHEAP_SETFAIL
Simulates heap allocation failure for the current thread's heap. The failure occurs on subsequent calls to new or any of the functions which allocate memory from the heap. This macro is defined only for debug builds
__UHEAP_RESET
Cancels simulated heap allocation failure for the current thread's heap. This macro is defined only for debug builds
__ASSERT_XXXX__
__ASSERT_ALWAYS
Asserts that a condition is true for all builds It catch programming errors early and aid in communicating the design and purpose of the class.
__ASSERT_DEBUG
Asserts that a condition is true for debug builds only.
__DECLARE_TEST / __TEST_INVARIANT
Checks the state of an object.
Other
GLDEF_C
Indicates that it is a global function and in practice is only used in this context.
_DEBUG
The code specific to debugging or testing can be excluded in release builds using this macro.
_UNICODE
Used for compiling the code for Unicode.
IMPORT_C
This should precede the declaration of a DLL function which is to be imported into an application program. It informs the compiler that the function is to be found in a DLL.
EXPORT_C
Export function from DLL. This should precede the implementation in C++ source of a DLL function which is to be exported. Such a function forms part of the DLL API and is available to application programs and other DLLs.
TRAP() and its variants
Used for light weight error handling, for more information refer Trap Article section.


06 Sep
2009
This article provides a very good reference for Macros available in Symbian. Also briefly describes its usage.