On 7/8/21 11:11 AM, DLearner wrote:
Hi

Please confirm that:
`
    assert(false, __FUNCTION__ ~ "This is an error message");
`

Will _not_ trigger GC issues, as the text is entirely known at compile time.

Best regards

One way of forcing compile-time evaluation in D is to define an enum (which means "manifest constant" in that use). I used @nogc to prove that there is no GC allocation as well:

@nogc
void main() {
  enum msg = __FUNCTION__ ~ "This is an error message";
  assert(false, msg);
}

Ali

Reply via email to