LearnFrenzy
Sign in Take a free test

Error Handling · Error Handling MCQ · Question 9

When is static_assert checked? Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 9 Back to Exercise

When is static_assert(sizeof(long) == 8, "need 64-bit long"); checked?

  • A At run time, every time it is reached
  • B At compile time – a false condition is a compile error Correct
  • C Only in debug builds
  • D At link time
Correct Answer: Option B

The condition must be an integer constant expression. A failing static_assert stops the build with the message, so wrong assumptions never reach users.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links