How do you debug @safe @nogc code? Can't figure out how to print.

aliak something at something.com
Sat Nov 17 21:16:13 UTC 2018


On Saturday, 17 November 2018 at 17:48:43 UTC, Neia Neutuladh 
wrote:
> On Sat, 17 Nov 2018 13:55:24 +0000, aliak wrote:
>> You can use "debug blah" to hide inside functions that are 
>> attributed, but when you have an attributed function that 
>> calls a template, attribtues of which are supposed to be 
>> inferred, it seems to fail.
>
> You can explicitly mark a templated function as @nogc. If you 
> want your function's @nogc-ness inferred, you can pull out the 
> debug logging into a separate function and explicitly mark it 
> @nogc.

Could do. But it's not scalable. I'd have to comment out all the 
unittests that call the template function with a T that allocates 
inside the @nogc template (if I understood you correctly that it)


More information about the Digitalmars-d-learn mailing list