CTFE output is kind of weired

Andre Pany via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jul 9 01:43:47 PDT 2017


On Sunday, 9 July 2017 at 06:48:30 UTC, Stefan Koch wrote:
> 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).

Thanks for all the answers and explanations. I will create an 
issue to make the assert output more readable. The first 5 times 
I didn't recognize the slice information at the end of the string 
and thought dmd isn't working at all anymore.

Kind regards
André


More information about the Digitalmars-d-learn mailing list