Wiki
Clone wikiphist / Developer_Guide / 03 Macros
Macros
A bunch of very useful macros are defined in this C/C++ header: src/tools/phist_macros.h .
predefined return codes and consistent error handling
Any PHIST function has as its last argument an integer flag *iflag. To make return values comprehensible, some standard values are defined in src/tools/phist_defs.h , which is included by phist_macros.h.
Macros checking the iflag argument (or in fact any integer value) are given by
- PHIST_CHK_IERR (which returns void)
- PHIST_ICHK_IERR (which returns an integer)
Typical uses are
- PHIST_CHK_IERR(SUBR(mvec_add_mvec)(ONE,V,ONE,W,iflag),*iflag); (to check the result of a type generic kernel call),
- PHIST_ICHK_IERR(ptr==NULL?PHIST_BAD_CAST:PHIST_SUCCESS,iflag); (to check that a pointer is not NULL in an int function, and return the standard error code for a 'bad cast or null pointer').
Tasking
TODO: add description of ghost task macros, for now see the source file src/kernels/phist_tasks.h ).
Updated