Closed
Description
Discussing the validity invariant of booleans.
The obvious invariant is:
- Must be either
true
orfalse
.
Is there any reason to allow any other value? In particular, this invariant means that no bit may be uninitialized.
As usual with bool, the remaining thing that can be bikeshed indefinitely is the interaction with FFI. Can we really assume that any function calling us from C only passes one of two possible bit patterns, on any platform? On which platforms can we be more specific and specify the actual bit patterns? AFAIK false == 0x00
is given by the fact that C allows 0-initialziation of _Bool
. Can we say anything about the bit pattern of true
?