[petsc-dev] PETSC_TRUE and PETSC_TRUTH

Kai Germaschewski kai.germaschewski at unh.edu
Thu Sep 2 15:50:08 CDT 2010


What is the reason for PetscTruth in the first place? Couldn't one just use
bool -- from stdbool.h if available, and otherwise have petsc define it? I
guess you might argue that petsc shouldn't invade non petsc-prefixed
namespace, which I guess is a valid argument, on the hand one might consider
that to just be petsc providing pretty much a standard type which is missing
from the current environment. Or are there any Fortran-glue issues that
prevent this?

There is PETSC_FLOAT and PETSC_DOUBLE, after all, but not PetscFloat,...

In general, I don't like having specific versions of what's basically a
standard type (I don't like PETSC_NULL, either). If you're using just one
library, maybe it's not that bad, but then there's herr_t, PetscErrorCode,
... for no (obvious to me) benefit.

Anyway, I'd be in favor of at least a change to PetscBool.

--Kai


On Thu, Sep 2, 2010 at 3:56 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:

>
>  We use truth consistently PetscTruth and PETSC_TRUTH, we cannot have one
> be bool.
>
>   For a long time I've wanted to replace all our uses of truth with bool
> but was afraid to make a change that pisses people off. That would resolve
> the problem.
>
>   Barry
>
> On Sep 2, 2010, at 2:04 PM, Satish Balay wrote:
>
> > On Thu, 2 Sep 2010, Chetan Jhurani wrote:
> >
> >> Hi petsc-dev,
> >>
> >> This is a minor enhancement request.
> >>
> >> Using PETSC_TRUTH instead of PETSC_TRUE unintentionally will lead to
> >> unexpected results and annoying bugs.  Seems like PETSC_TRUTH is
> >> a different enum value for enumerating data types and currently equals
> 9.
> >>
> >> g++ does warn on comparing different enum types, but gcc does not
> (v4.3.0).
> >>
> >> Any possibility of changing the name of PETSC_TRUTH to something
> >> that is far away from PETSC_TRUE?
> >
> >
> > Perhaps we should use PETSC_BOOL instead of PETSC_TRUTH..
> >
> > Satish
>
>


-- 
Kai Germaschewski
Assistant Professor, Dept of Physics / Space Science Center
University of New Hampshire, Durham, NH 03824
office: Morse Hall 245E
phone:  +1-603-862-2912
fax: +1-603-862-2771
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20100902/58697920/attachment.html>


More information about the petsc-dev mailing list