The biggest mistake of C was CPP
Hey, we can eliminate the currently needed (PetscObject) cast in a bunch of
places with this horrible trick.
This actually doesn't introduce any more macros, its the same number with
more reasonable naming.
Barry
On Apr 5, 2013, at 7:50 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:
>
> On Fri, Apr 5, 2013 at 7:40 PM, Barry Smith <bsmith at mcs.anl.gov> 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?