Opened 9 years ago
Closed 4 years ago
#9561 closed Tasks (wontfix)
tribool documentation suggestion
Reported by: | Owned by: | James E. King, III | |
---|---|---|---|
Milestone: | To Be Determined | Component: | logic |
Version: | Boost 1.55.0 | Severity: | Not Applicable |
Keywords: | Cc: |
Description
Please add warning to docs (like basic usage of tribool) that you can't write like this.
false==0, so it casted to function pointer, so this expression is always indeterminate, not false:
tribool a = 0? indeterminate : false;
true!=0, so cast goes other way - indeterminate casted to bool, this epression always true, not indeterminate:
tribool b = 1? indeterminate : true;
Change History (2)
comment:1 by , 4 years ago
Owner: | changed from | to
---|
comment:2 by , 4 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
The two operands to ? have different types. One is used by tribool (which is not a bool), and one is a bool. If you enable C++11 the compiler properly detects this issue and fails. If you use C++03 it does fail as documented. I'm not certain it's worth documenting this behavior for C++03 however, so I am going to resolve this as wontfix. It can be reopened as a github issue if folks feel strongly it needs to be addressed.