On Mon, Jul 20, 2009 at 5:01 PM, Barry Smith<bsmith at mcs.anl.gov> wrote: > > ?Sorry, fixed. > > ?Say, isn't it about time we abolish PetscTruth? Are the C and C++ bool > compatible with each other and compatible with Fortran 90's logical? >
C99 "_Bool" and C++ "bool" are likely compatible, at least if the same compiler suite is used... in GCC, both have sizeof() == 1 . I remember this surprised you some time ago, and even you said it was a nonsense (you gave alignment arguments, though I failed to find any issues there)... Regarding Fortran, I'm not so sure about compatibility... we could have two problems: 1) non-matching sizeof() with the C99/C++ type, though in F90 we could use logical(kind=XXX), right? 2) Can we be 100% sure that in Fortran .TRUE./.FALSE. match C99/C++ true/false in a bit-by-bit basis? I mean, is .FALSE. a 0 (zero) at the binary level? > ? Barry > > On Jul 20, 2009, at 12:51 PM, Lisandro Dalcin wrote: > >> Barry, this time you are the guy to blame ;-) (at least for the push) >> >> All these lines like below in src/mat/impls/aij/mpi/mpiaij.c are >> wrong, you do not have implicit bool -> enum in C++. >> >> MatStashValuesXXX_Private(...., ignorezeroentries && (addv == ADD_VALUES)) >> >> >> libfast in: /usr/local/petsc/3.0.0/src/mat/impls/aij/mpi >> mpiaij.c: In function PetscErrorCode MatSetValues_MPIAIJ(_p_Mat*, >> PetscInt, const PetscInt*, PetscInt, const PetscInt*, const >> PetscScalar*, InsertMode): >> mpiaij.c:396: error: cannot convert bool to PetscTruth for argument 6 >> to PetscErrorCode MatStashValuesRow_Private(MatStash*, PetscInt, >> PetscInt, const PetscInt*, const PetscScalar*, PetscTruth) >> mpiaij.c:398: error: cannot convert bool to PetscTruth for argument 7 >> to PetscErrorCode MatStashValuesCol_Private(MatStash*, PetscInt, >> PetscInt, const PetscInt*, const PetscScalar*, PetscInt, PetscTruth) >> mpiaij.c: In function void matsetvaluesmpiaij_(_p_Mat**, PetscInt*, >> const PetscInt*, PetscInt*, const PetscInt*, const PetscScalar*, >> InsertMode*, PetscErrorCode*): >> mpiaij.c:5242: error: cannot convert bool to PetscTruth for argument 6 >> to PetscErrorCode MatStashValuesRow_Private(MatStash*, PetscInt, >> PetscInt, const PetscInt*, const PetscScalar*, PetscTruth) >> mpiaij.c:5244: error: cannot convert bool to PetscTruth for argument 7 >> to PetscErrorCode MatStashValuesCol_Private(MatStash*, PetscInt, >> PetscInt, const PetscInt*, const PetscScalar*, PetscInt, PetscTruth) >> >> >> -- >> 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 > > -- 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