| 1dc74096 | 21-Jul-2025 |
Martin Diehl <mail@martin-diehl.net> |
use standard bool instead of enum
PetscBool is equivalent to _Bool/bool in C
For C standards prior to C23, true = 1 and false = 0 are defined in <stdbool.h>. For C23, true and false are real keywor
use standard bool instead of enum
PetscBool is equivalent to _Bool/bool in C
For C standards prior to C23, true = 1 and false = 0 are defined in <stdbool.h>. For C23, true and false are real keywords.
The Fortran equivalent is logical(C_BOOL) with C_BOOL from ISO_C_binding.
The C and the C++ standard do not specify the size of Booleans, but they typically have a size of 1 Byte with b00000000 for false and b00000001 for true. When using compilers from the same vendor, it is sane to assume that _Bool/bool in C and bool in C++ are fully compatible. But that is not guaranteed by the standards
show more ...
|