Opened 8 years ago
Closed 8 years ago
#6325 closed defect (fixed)
Detect int/bool mismatches
Reported by: | Even Rouault | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | default | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: | Kurt Schwehr |
Description
MSVC warns (and errors out in /WX mode) with stuff like "bool b = 1;". This is not easily detectable with compilers available in Linux.
So here's a hack that #define bool MSVCPedanticBool, where MSVCPedanticBool is a C++ class that has a private MSVCPedanticBool(int bIn) constructor. It must be enabled with -DDEBUG_BOOL
Change History (7)
comment:1 by , 8 years ago
comment:3 by , 8 years ago
trunk r33095 "Add hack enabled by -DDEBUG_BOOL to detect implicit int->bool conversions that dislike MSVC, and do changes needed to make code compile. Some drivers using C++ headers using bool use -DDO_NOT_USE_DEBUG_BOOL to disable locally DEBUG_BOOL. This mode is only intended to be used at compile time since fragile and known to cause issues in at least the MongoDB driver at runtime (#6325)"
comment:4 by , 8 years ago
Cc: | added |
---|
comment:5 by , 8 years ago
comment:6 by , 8 years ago
comment:7 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
trunk r33093 "Improve bool'ness (and add explicit static_cast<int>() for printf like operations to be compatible of a bool being a C++ object) (#6325)"