Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 1
    I really don't think it's possible to create a static assert in plain C, would love to know though! Commented Apr 30, 2009 at 14:42
  • Duplicate with several good answers: stackoverflow.com/questions/174356/… Commented Apr 30, 2009 at 15:07
  • 8
    Since this question is relatively old: _Static_assert and its associated macro static_assert are standardized as of C11. This is now built-in to the language. Commented Nov 22, 2015 at 2:00
  • 1
    Surely the optimizer can throw away empty switches. Commented Feb 17, 2017 at 19:13