avoiding incorrect code

Barry Smith bsmith at mcs.anl.gov
Wed Jan 14 16:20:49 CST 2009


On Jan 14, 2009, at 4:11 PM, Satish Balay wrote:

> On Wed, 14 Jan 2009, Barry Smith wrote:
>
>>> But imposing coding guidelines [which are unenforceable] to hide
>>> compiler differences is a bad policy..
>>
>>    This has nothing to do with compiler differences; just because
>> some Fortran compilers use the bit pattern of 1 for .true. and some
>> use -1 does not change the fact that a PetscTruth value of 0 is
>> false while any other value is true.
>
> Well our UserInterface [PETSC_TRUE,PETSC_FALSE] says one thing - but
> now we are relying on a different UI [i.e only PETSC_FALSE is relavent
> - PETSC_TRUE as currently defined is irrelavant - as everything else
> other than PETSC_FALSE should be PETSC_TRUE]

   PETSC_TRUE is used when assigning a PetscTruth value the .true.  
value.

    Barry

>
>
> I guess we can add in a python script to detect this uasage in code
> [as we check for other things - doc related - in builddist anyway]
>
>> I don't know where the == PETSC_TRUE nonsense came from, it could be
>> my fault. But the coding standard has been there for many years and  
>> most
>> == PETSC_TRUE stuff was removed years ago.
>
> Well I added in the code which was user-contributed. But I could
> verywell have done it - as I didn't remember this code guideline [and
> the reason for it..]
>
> Satish
>




More information about the petsc-dev mailing list