Quantcast
Channel: User HolyBlackCat - Stack Overflow
Viewing all articles
Browse latest Browse all 1287

Comment by HolyBlackCat on Switch case: Return from impossible default case

$
0
0
"putting an assert at the end doesn't seems correct" Why not? Also if you only have two states, it sounds like a job for bool, not a enum, then you won't have this problem. Also I recommend not adding a default: branch to enable the warning for unhandled enum values (on GCC & Clang), and handle invalid values below the switch instead.

Viewing all articles
Browse latest Browse all 1287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>