Re: [petsc-dev] macro wrappers around functions to caste suck
On Apr 7, 2013, at 5:02 PM, Jed Brown <[email protected]> wrote:
Barry Smith <[email protected]> writes:
Seems inconsistent to only handle the cast automatically for some. We should do it all or nothing. That is be C++ish and let the user always pass a subclass where the class is expected or be C ish and always require the cast.
Unfortunately, there is no way to allow implicit conversion for subclasses without implicitly converting everything.
True, people could pass any crazy thing in there. The only hope is that the runtime checking of PetscObjects would get any non-PetscObjects passed in.
The explicit cast is visually jarring enough to make it obvious at the call site that that argument must be a PetscObject. I'm pretty indifferent about changing it.
I am fine with leaving the code as is at this time. Presumably the cast for function pointers IS needed for certain C++ compilers and cannot (or should not?) be done manually by users so we would do the trick for those? Barry
participants (1)
-
Barry Smith