#525: Clean up CCTK_GFINDEX definitions -------------------------+-------------------------------------------------- Reporter: eschnett | Owner: Type: enhancement | Status: new Priority: minor | Milestone: Component: Cactus | Version: Keywords: | -------------------------+-------------------------------------------------- The way in which CCTK_GFINDEX is defined is a bit complex, probably unnecessarily so. The file cctk.h distinguishes between compilers which support inlining and compilers which don't. This is probably useless these days since every compiler supports inlining, and if not, we don't really expect it to be fast.
If the compiler supports inlining, we define static inline functions, which may or may not check array indices. If the compiler does not support inlining, and if CCTK_DEBUG is defined, then we use regular functions defined in DebugDefines.c, otherwise (i.e. without CCTK_DEBUG) we use macros.
Overall, the indexing functions are defined three times, including once as macros. I suggest to simplify this, based on the assumption that every fast compiler supports inlining. I assume so because (a) the ubiquity of C++, which relies heavily on inlining, and (b) C99 officially introduced inlining 12 years ago.
The new setup would have "static inline" definitions (without index checking) in cctk.h, and would have regular functions (with index checking) in DebugDefines.c, and would choose between these two implementations via CCTK_DEBUG.
This would eliminate the macros, and would eliminate the case distinction based on whether the compiler supports inlining.
#525: Clean up CCTK_GFINDEX definitions --------------------------+------------------------------------------------- Reporter: eschnett | Owner: Type: enhancement | Status: review Priority: minor | Milestone: Component: Cactus | Version: Resolution: | Keywords: --------------------------+------------------------------------------------- Changes (by eschnett):
* status: new => review
Comment:
Please review.
#525: Clean up CCTK_GFINDEX definitions --------------------------+------------------------------------------------- Reporter: eschnett | Owner: Type: enhancement | Status: review Priority: minor | Milestone: Component: Cactus | Version: Resolution: | Keywords: --------------------------+-------------------------------------------------
Comment (by rhaas):
Look ok to me.
#525: Clean up CCTK_GFINDEX definitions --------------------------+------------------------------------------------- Reporter: eschnett | Owner: Type: enhancement | Status: review Priority: minor | Milestone: ET_2012_05 Component: Cactus | Version: Resolution: | Keywords: --------------------------+------------------------------------------------- Changes (by eschnett):
* milestone: => ET_2012_05
#525: Clean up CCTK_GFINDEX definitions --------------------------+------------------------------------------------- Reporter: eschnett | Owner: Type: enhancement | Status: reviewed_ok Priority: minor | Milestone: ET_2012_05 Component: Cactus | Version: Resolution: | Keywords: --------------------------+------------------------------------------------- Changes (by knarf):
* status: review => reviewed_ok
Comment:
Please apply
#525: Clean up CCTK_GFINDEX definitions --------------------------+------------------------------------------------- Reporter: eschnett | Owner: Type: enhancement | Status: closed Priority: minor | Milestone: ET_2012_05 Component: Cactus | Version: Resolution: fixed | Keywords: --------------------------+------------------------------------------------- Changes (by eschnett):
* status: reviewed_ok => closed * resolution: => fixed
Comment:
Applied.
trac@lists.einsteintoolkit.org