Skip to content

Implicit fallthroughs #4929

Description

@r-barnes

Are these implicit fallthroughs intentional? If so, can we mark them with [[fallthrough]]?

default: end_loop = true;

Activity

  1. kkm000 commented on Aug 28, 2024

    @kkm000
    Contributor

    Yes. In both cases, we've just read the closing token <!EndOfComponent> and are falling through the default case, or didn't read any tokens at all, and breaking the loop at the first iteration.

    [[fallthrough]] would be nice indeed. I guess the C++17 compiler yells at you? A C++14-compatible alternative is to repeat end_loop = true; and have the case end with the break;

    @jtrmal, @danpovey, we are C++17 by default now, ain't we? No longer C++14? I can't think of a compiler that wouldn't C++17 these days.

  2. self-assigned this
    on Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions