News for hackers. Stuff that matters.
Re:Is C# Underhyped? by briHass on Thursday December 07, 2023 @11:14PM (#38565370)
Blame C/C++ for the switch complaint. C#'s design was to avoid a lot of those nasty pitfalls by making you be explicit about your intent. You don't have to use a break, but you do have to explicitly exit out of the switch, so a return, or throw, or (gasp) goto works also. This means forgetting a break is a compiler error, not the silent execution of subsequent cases, which is probably a trick employed purposefully in C++ like 5% of the time and a nasty bug for every other instance.

There are no comments on this comment yet.