What is the difference between “option” and “set CACHE BOOL” for a CMake variable?

In your example, there is no difference. But there can be differences: option has a default value of OFF. You can make an option dependent on other options with CMakeDependentOption set accepts types other than BOOL, especially ;-lists. Additionally, when you use an option you are indicating to your user that it can be set … Read more

True/False vs 0/1 in MySQL

Some “front ends”, with the “Use Booleans” option enabled, will treat all TINYINT(1) columns as Boolean, and vice versa. This allows you to, in the application, use TRUE and FALSE rather than 1 and 0. This doesn’t affect the database at all, since it’s implemented in the application. There is not really a BOOLEAN type … Read more

Do the &= and |= operators for bool short-circuit?

From C++11 5.17 Assignment and compound assignment operators: The behavior of an expression of the form E1 op = E2 is equivalent to E1 = E1 op E2 except that E1 is evaluated only once. However, you’re mixing up logical AND which does short-circuit, and the bitwise AND which never does. The text snippet &&=, … Read more

Valid JavaBeans names for boolean getter methods

According to the JavaBeans specification section 8.3.2: Boolean properties In addition, for boolean properties, we allow a getter method to match the pattern: public boolean is<PropertyName>(); This “isPropertyName” method may be provided instead of a “get<PropertyName>” method, or it may be provided in addition to a “get<PropertyName>” method. In either case, if the is<PropertyName> method … Read more