[petsc-dev] PETSC_TRUE and PETSC_TRUTH

Jed Brown jed at 59A2.org
Thu Sep 2 18:02:50 CDT 2010


On Thu, 2 Sep 2010 18:08:12 -0400, Kai Germaschewski <kai.germaschewski at unh.edu> wrote:
> I know that bool is not standard (in plain old C). However, as you say, it
> is in C++ and C99, and in as extension in some older compilers. I have no
> doubt there was a good reason to introduce the type at the time, but that
> doesn't necessarily mean you have to keep carrying it along forever, in
> particular if you're changing the wording anyway. The one issue I do see is
> if an existing application has, e.g., typedef int bool; while the petsc
> header says typedef enum { false, true } bool;

FWIW, neither of these are valid definitions, they have a different size
than the bool in stdbool.h (technically the size of the enum is
implementation-dependent, but it is almost certainly the same size as
int, while bool is 1 byte).

Jed



More information about the petsc-dev mailing list