Closed linusheck closed 3 months ago
ok, it seems like
constexpr
is only for compile-time, which is not adequatehttps://stackoverflow.com/questions/10593492/catching-assert-with-side-effects
This has a cool way of catching that the compiler knows an expression has no side-effects, but the Storm codebase is not a large legacy codebase, so this would be super overkill and it's fine as it is :)
Hi, I was just bit by a silly error where I had something with side effects in my
STORM_LOG_ASSERT
, which was not executed in release mode. My idea was to add something intoSTORM_LOG_ASSERT
that ensures that there are no side effects, but this apparently cannot be done, becauseconstexpr
is actually compile-time and there is no alternative that checks for "no side effects", e.g. onlyconst
function invocations (which I know can have side effects) and their compositions with simple operators (which can of course also have side effects)