https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96245

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
I wonder if discouraging this pattern by warning on it and suggesting the
simpler alternative would be worthwhile (either in addition to or in lieu of
the optimization) to help avoid typos resulting from copy-and-paste mistakes
that cannot very well be detected.  As in:

void f(int x)
{
    switch (x)
    {
        case 0:
            putchar('0');
            break;
        case 1:
            putchar('1');
            break;
        ...
        case 7:
            putchar('6');   <<< typo
            break;
        ...
  }

Reply via email to