May 14, 2021
On Thursday, 13 May 2021 at 17:52:52 UTC, rempas wrote:
> On Thursday, 13 May 2021 at 16:48:36 UTC, Steven Schveighoffer wrote:
>> First step is to make implicit fallthrough an error instead of a deprecation. Then after a time, we might be able to make break optional.
>>
>> -Steve
>
> Exactly! I hope the community will think about it. Like I said, I don't think having some stuff like they are just to do it is a good thing for anyone.

Implicit fallthrough was not deprecated "just to do it". There were reasons. Doing so caught bugs and was generally well-received. Example:

https://forum.dlang.org/post/lgoda9$23dc$1@digitalmars.com
May 13, 2021
On 5/13/2021 7:15 AM, Steven Schveighoffer wrote:
> Nobody thinks case fallthrough is good, this is why it's a warning and deprecated.

I used to, but I've come around :-)
May 14, 2021

On Thursday, 13 May 2021 at 16:56:58 UTC, Adam D. Ruppe wrote:

>

On Thursday, 13 May 2021 at 16:51:07 UTC, Imperatorn wrote:

>

Please don't add more to the language. Just remove fallthrough. Done.

Or better yet just leave it alone (existing deprecation to error is ok though). The explicit status quo is a solid situation.

Exactly this. The error should not go away, because it would be a major silent difference when porting code from C. And common, adding break doesn't have any kind of objective downside.

May 14, 2021
On Friday, 14 May 2021 at 00:42:47 UTC, Mike Parker wrote:

> Implicit fallthrough was not deprecated "just to do it". There were reasons. Doing so caught bugs and was generally well-received. Example:
>
> https://forum.dlang.org/post/lgoda9$23dc$1@digitalmars.com

Yeah but we have to add "break" every time? No ones uses this feature anymore (thus the warnings) because we can add more cases. This is what I mean by saying "doing things just to do them". While I agree that code that looks like C should act like C but I think we can make one exception here! But anyway just my opinion
May 14, 2021
On Friday, 14 May 2021 at 06:21:10 UTC, rempas wrote:
>
>
> Yeah but we have to add "break" every time? No ones uses this feature anymore (thus the warnings) because we can add more cases. This is what I mean by saying "doing things just to do them". While I agree that code that looks like C should act like C but I think we can make one exception here! But anyway just my opinion

But C supports implicit fallthrough, so by deprecating it, we did make an exception. Ans it's a good exception to make.
May 14, 2021
On Friday, 14 May 2021 at 06:56:55 UTC, Mike Parker wrote:

>
> But C supports implicit fallthrough, so by deprecating it, we did make an exception. Ans it's a good exception to make.

Here's what the C++ Core Guidelines say:

"Always end a non-empty case with a break. Accidentally leaving out a break is a fairly common bug. A deliberate fallthrough can be a maintenance hazard and should be rare and explicit."

This is the same reason it's deprecated in D.


https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es78-dont-rely-on-implicit-fallthrough-in-switch-statements
May 14, 2021
On Friday, 14 May 2021 at 07:00:50 UTC, Mike Parker wrote:
> On Friday, 14 May 2021 at 06:56:55 UTC, Mike Parker wrote:
>
>>
>> But C supports implicit fallthrough, so by deprecating it, we did make an exception. Ans it's a good exception to make.
>
> Here's what the C++ Core Guidelines say:
>
> "Always end a non-empty case with a break. Accidentally leaving out a break is a fairly common bug. A deliberate fallthrough can be a maintenance hazard and should be rare and explicit."
>
> This is the same reason it's deprecated in D.
>
>
> https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es78-dont-rely-on-implicit-fallthrough-in-switch-statements

Additionally, since C++17, there is the fallthrough attribute to be explicit that the C behaviour is actually intended.

https://en.cppreference.com/w/cpp/language/attributes/fallthrough
May 14, 2021
On Friday, 14 May 2021 at 08:24:46 UTC, Paulo Pinto wrote:
ines.md#es78-dont-rely-on-implicit-fallthrough-in-switch-statements
>
> Additionally, since C++17, there is the fallthrough attribute to be explicit that the C behaviour is actually intended.
>
> https://en.cppreference.com/w/cpp/language/attributes/fallthrough

Man that's ugly. I like our `goto case` better.
May 14, 2021
On Friday, 14 May 2021 at 08:37:19 UTC, Mike Parker wrote:
> Man that's ugly. I like our `goto case` better.

It is an attribute to silence optional warnings (basically to support "linting"). It is consistent with other silencing attributes.

The C++ language does fall through.

May 14, 2021
On Friday, 14 May 2021 at 06:56:55 UTC, Mike Parker wrote:
> On Friday, 14 May 2021 at 06:21:10 UTC, rempas wrote:
>>
>>
>> Yeah but we have to add "break" every time? No ones uses this feature anymore (thus the warnings) because we can add more cases. This is what I mean by saying "doing things just to do them". While I agree that code that looks like C should act like C but I think we can make one exception here! But anyway just my opinion
>
> But C supports implicit fallthrough, so by deprecating it, we did make an exception. Ans it's a good exception to make.

And even C compilers warn now about implicit fallthrough (gcc since version 8 with -Wall).