Re: [petsc-dev] macro wrappers around functions to caste suck
On Fri, Apr 5, 2013 at 7:40 PM, Barry Smith <[email protected]> wrote:
(lldb) b PetscFunctionListAdd Breakpoint 4: no locations (pending). WARNING: Unable to resolve breakpoint to any actual locations. (lldb) b PetscFunctionListAdd_Private Breakpoint 5: where = libpetsc.dylib`PetscFunctionListAdd_Private + 23 at reg.c:173, address = 0x000000010a1d3697
The solution to too many macros is always MOAR MACROS! This is valid: PETSC_EXTERN PetscErrorCode PetscFunctionListAdd(PetscFunctionList*,const char[],void (*)(void)); #define PetscFunctionListAdd(list,name,fptr) PetscFunctionListAdd((list),(name),(PetscVoidFunction)(fptr)) off in the implementation: #undef PetscFunctionListAdd PETSC_EXTERN PetscErrorCode PetscFunctionListAdd(PetscFunctionList *fl,const char name[],void (*fnc)(void)) { ... } This would make the debugging thing work, at the expense of being slightly more confusing to the reader. But maybe comments would be enough to explain what's going on?
participants (1)
-
Jed Brown