Our friend R.L. writes in with a twist on a common snippet, illustrating an important scientific fact: solutions in life are rarely just TRUE or FALSE ...

 

 

 
  #if !defined TRUE 

  #define         TRUE            1

  #endif

  #if !defined FALSE

  #define         FALSE           0

  #endif

  #define         MAYBE           2

 

R.L. writes, "Note how the author implicitly acknowledges that no one else would be stupid enough to create a MAYBE constant with his lack of checking if it's already defined."

The enumeration leaves the usual ambiguity if other programmers don't know there's a MAYBE, and they innocently use a negation test. For example, !TRUE could be FALSE or MAYBE, while !FALSE could be TRUE or MAYBE.

And now for the icing: this is a function used to determine geometric intersections. One would assume that "maybe" a plane hitting a box at least requires further testing. Given this usage, there are definitely situations where it's safer to assume that a "maybe" is TRUE and not FALSE:

"You should MAYBE turn left at the next intersection and go 5 miles, versus turning right and going approx. 23995 miles."

"The missle defense system says we should MAYBE shoot down this incoming missle, it is MAYBE striking us shortly..."

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!