[petsc-dev] macro wrappers around functions to caste suck

Barry Smith bsmith at mcs.anl.gov
Sun Apr 7 16:46:53 CDT 2013


On Apr 7, 2013, at 4:16 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> Barry Smith <bsmith at mcs.anl.gov> writes:
> 
>>   That was my rationalization for ugly code; until a better solution
>>   appeared and I no longer needed the rationalization :-)
> 
> Okay, are we removing _all_ those casts, or only for a few highly-used
> PetscObject functions?  PetscObjectComm() is one we changed recently.

  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.

> 
> Note that absorbing the cast into the macro is backward-compatible in
> that code with an explicit cast continues to work without a warning.

   Ok, then we shouldn't make this change, you know I hate changes that are backward compatible :-)






More information about the petsc-dev mailing list