On 9/27/13 6:52 PM, Walter Bright wrote:
Is it not worth to put a
message after the 0/false? (static assert(0, "foo missing"); )
I find assert messages to be redundant, pointlessly repeating what is
obvious from the context, and saying things an extra time.
But I'm in the minority with that opinion.
On my team we found this to be the case for static asserts. Dynamic
asserts are more often preceded by an explanatory comment. A couple of
quick examples from a grep search, revealing a grab bag:
// missing token!
always_assert(false);
// should be handled in onfunction / onmethod
always_assert(false);
// where do we output n_HEREDOC?
always_assert(false); // unexpected
assert(IS_STRING_TYPE(cell->m_type));
assert(IsValidKey(k));
// Array escalation must not happen during these reserved
// initializations.
assert(newp == m_data);
static_assert(!(KindOfBoolean & KindOfStringBit), "");
static_assert(keyType != KeyType::Any,
"KeyType::Any is not supported in arraySetMImpl");
Andrei