Andrew Gierth <and...@tao11.riddles.org.uk> writes: > "Tom" == Tom Lane <t...@sss.pgh.pa.us> writes: > Tom> I'm inclined to think that we need to make ecpglib.h's > Tom> bool-related definitions exactly match c.h,
> I'm wondering whether we should actually go the opposite way and say > that c.h's "bool" definition should be backend only, and that in > frontend code we should define a PG_bool type or something of that ilk > for when we want "PG's 1-byte bool" and otherwise let the platform > define "bool" however it wants. > And we certainly shouldn't be defining "bool" in something that's going > to be included in the user's code the way that ecpglib.h is. The trouble here is the hazard of creating an ABI break, if we modify ecpglib.h in a way that causes its "bool" references to be interpreted differently than they were before. I don't think we want that (although I suspect we have inadvertently caused ABI breaks already on platforms where this matters). In practice, since v11 on every modern platform, the exported ecpglib functions have supposed that "bool" is _Bool, because they were compiled in files that included c.h before ecpglib.h. I assert furthermore that clients might well have included <stdbool.h> before ecpglib.h and thereby been fully compatible with that. If we start having ecpglib.h include <stdbool.h> itself, we'll just be eliminating a minor header inclusion order hazard. It's also rather hard to argue that including <stdbool.h> automatically is really likely to break anything that was including ecpglib.h already, since that file was already usurping those symbols. Except on platforms where sizeof(_Bool) isn't 1, but things are already pretty darn broken there. I think it's possible to construct a counterexample that will fail for *anything* we can do here. I'm not inclined to uglify things like mad to reduce the problem space from 0.1% to 0.01% of use-cases, or whatever the numbers would be in practice. regards, tom lane