Enums and Switches - Peanut Butter and Jelly and Rye Bread
Channel:
Subscribers:
2,810
Published on ● Video Link: https://www.youtube.com/watch?v=93wRZk-BY-0
The only real reason to use a switch (other than some optimization efforts) is to use them in conjunction with an enum. By doing so, the compiler can tell that you're missing an enum and give you a nice warning for it.
But in general switch statements suck since they use non-standard flow control (i.e. no curly braces) and people always forget the break statements on them.
I didn't mention it in the video, but if you do want to use switch statements and intentionally omit the break statement, look up the fallthrough attribute.
Other Videos By Bill Kerney
| 2023-09-13 | C++: Pure vs Impure Functions |
| 2023-09-12 | UE5: Landscape Materials, Landscape Layers, Landscape Grass Output |
| 2023-09-12 | Voronoi Diagrams + the Inline and Static keywords in C++ |
| 2023-09-11 | C++: Random Numbers |
| 2023-09-07 | Game Design Day 2 |
| 2023-09-07 | Introduction to Dear ImGui |
| 2023-09-06 | C++ Functions |
| 2023-09-05 | Principles of Game Design |
| 2023-09-05 | Dynamic Materials |
| 2023-09-03 | The Difference Between G++ and Clang++ |
| 2023-09-01 | Enums and Switches - Peanut Butter and Jelly and Rye Bread |
| 2023-08-31 | UE5 New Water System |
| 2023-08-31 | Wireframe Triangles + Book Recommendations |
| 2023-08-30 | Loop Lab Time |
| 2023-08-30 | C++: The Read Library |
| 2023-08-30 | You should go to grad school |
| 2023-08-29 | Loops Day 3 / Strings / Range-Based For Loops |
| 2023-08-29 | Line Rasterization / Triangle Rasterization / Convex Hull Rasterization |
| 2023-08-29 | UE5: Water Week Day 1 |
| 2023-08-28 | Makefile Tutorial |
| 2023-08-25 | C++: Counting in Japanese and Mandarin |

