logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

SDL_FALLTHROUGH - A macro to signal that a case statement without a break is intentional.

Availability

       This macro is available since SDL 3.2.0.

Simple Directmedia Layer                           SDL 3.2.10                                 SDL_FALLTHROUGH(3)

Description

       C  compilers  have  gotten  more  aggressive about warning when a switch's case block does not end with a
       break or other flow control statement, flowing into the next case's code, as this is  a  common  accident
       that  leads  to  strange  bugs. But sometimes falling through to the next case is the correct and desired
       behavior. This symbol lets an app communicate this intention to the compiler, so it  doesn't  generate  a
       warning.

       It is used like this:

              switch (x) {
                  case 1:
                      DoSomethingOnlyForOne();
                      SDL_FALLTHROUGH;  // tell the compiler this was intentional.
                  case 2:
                      DoSomethingForOneAndTwo();
                      break;
              }

Header File

       Defined in SDL3/SDL_begin_code.h

Name

       SDL_FALLTHROUGH - A macro to signal that a case statement without a break is intentional.

Synopsis

#include"SDL3/SDL.h"#defineSDL_FALLTHROUGH[[fallthrough]]

See Also