CTFE output is kind of weired

Stefan Koch via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jul 8 23:48:30 PDT 2017


On Sunday, 9 July 2017 at 04:03:09 UTC, H. S. Teoh wrote:
> On Sat, Jul 08, 2017 at 03:09:09PM -0700, Ali Çehreli via 
> Digitalmars-d-learn wrote:
>> On 07/08/2017 02:29 PM, Andre Pany wrote:
>> 
>> > I use assert(false, tmp) to see the content of variable tmp 
>> > as it seems there is no other way in CTFE.
>> 
>> A more natural way is pragma(msg), which you can use in main 
>> in this
>> case:
> [...]
>
> Unfortunately, pragma(msg) can only be used *after* CTFE has 
> finished. It's not possible to print the message *during* CTFE.
>
> Stefan Koch allegedly will add a ctfeWriteln to his new CTFE 
> engine that should alleviate this limitation.
>
>
> T

In fact ctfeWriteln harder to do for newCTFE then it is in the 
old interpreter.
I suggest people stick with either returning a string or 
assert(0, message).


More information about the Digitalmars-d-learn mailing list