[petsc-dev] PETSC_TRUE and PETSC_TRUTH

Dmitry Karpeev karpeev at mcs.anl.gov
Thu Sep 2 15:14:33 CDT 2010


PetscBool and PETSC_BOOL is the right way to go, in my opinion.
I've inadvertently swapped PETSC_TRUE and PETSC_TRUTH in the past myself.

Dmitry.

On Thu, Sep 2, 2010 at 2: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
>
>



More information about the petsc-dev mailing list