On Tuesday, 19 January 2021 at 20:27:30 UTC, Andrey Zherikov wrote:
Could someone please explain why there is a difference in values between compile-time and run-time?

[...]
void main()
{
    pragma(msg, TENUM.foo);    // T(2)
    pragma(msg, TENUM.bar);    // T(3)
    writeln(TENUM.foo);        // foo
    writeln(TENUM.bar);        // bar
}

There is no difference in the values, they're just being printed differently. pragma(msg) uses the compiler's internal string-conversion routines, and writeln uses the ones from Phobos, so it's not too surprising that they would display some values differently.

Reply via email to