|
|
|
|
|
by matthewkayin
118 days ago
|
|
The problem pointed out in the article seems a little silly. We're adding an entire language feature because someone wanted an optional bool class? Why not just create a uint8_t with three values: OPTIONAL_BOOL_FASLE, OPTIONAL_BOOL_TRUE, OPTIONAL_BOOL_UNDEFINED? Doing so takes the same space as a bool, and could be wrapped in a class if desired to provide a nicer interface. |
|
What I was surprised with was that their union code was valid. I thought accessing a union member that was not active was valid in C, but not in C++.