CTFE write message to console
Paolo Invernizzi
paolo.invernizzi at gmail.com
Fri Apr 5 07:37:20 UTC 2024
On Thursday, 4 April 2024 at 15:43:55 UTC, Carl Sturtivant wrote:
> On Thursday, 4 April 2024 at 15:07:21 UTC, Richard (Rikki)
> Andrew Cattermole wrote:
>>
>> Ah yes, I forgot about that particular thing, doesn't see much
>> use as far as I'm aware.
>>
>> It should be working though.
>
> ```D
> enum X = computeX("A message");
>
> string computeX(string msg) {
> auto s = "CTFE msg: ";
> auto x = imported!"std.format".format("%s%s\n", s, msg);
> __ctfeWrite(x);
> return x;
> }
>
> void main() {
> import std.stdio;
> writeln(X);
> }
> ```
> Produces no output on compilation, and writes out `CTFE msg: A
> message` when run.
pragma(msg, x) ?
More information about the Digitalmars-d-learn
mailing list