PetscTruth bool?

Barry Smith bsmith at mcs.anl.gov
Wed Sep 24 10:57:08 CDT 2008


On Sep 24, 2008, at 9:27 AM, Lisandro Dalcin wrote:

> On Wed, Sep 24, 2008 at 10:51 AM, Barry Smith <bsmith at mcs.anl.gov>  
> wrote:
>>
>>  Since C++ has bool and C99 has bool, should PetscTruth be changed  
>> to be
>> defined to be bool? Instead of int.
>
> You mean instead of an enumeration, C++ is a bit more strict than C in
> this point. At this point I'm +0 on this, but perhaps you could
> elaborate a bit more the rationale for the change?

    All the ugly (PetscTruth) cast that are in the code and needed by C 
++.

    If we can use a language feature 100% and it does not impose any
constraints that we would not have otherwise then a good general policy
would be to use it.

     Barry

>
>
>
>>
>> Should we go further and simply remove PetscTruth and use bool  
>> directly in
>> its place? (logical in Fortran).
>>
>
> Well, not sure again. In the same spirit, we could introduce
> 'PetscIndex' for integers that works as indices in vectors and
> matrices, and plain 'int' for other things, like an iteration counter.

>
>
> In short, such changes are more or less good, of course users will cry
> porting their codes, and we have to update a lot of code. But anyway
> PETSc developers never hesitate to do that if really needed. The
> question is if such changes would really pay in the long term.
>
>
>
> -- 
> Lisandro Dalcín
> ---------------
> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
> Tel/Fax: +54-(0)342-451.1594
>




More information about the petsc-dev mailing list