Catch It Early

What advantage does static_assert have over a runtime assert?

A

static_assert works in release builds, while assert is stripped out

B

static_assert produces faster executable code because it adds runtime checks that the CPU can branch-predict

C

static_assert catches the error at compile time, before the program ever runs, with zero runtime cost

D

static_assert can check conditions involving runtime variables, while assert cannot