Avoiding GC in D and code consistancy

Seb seb at wilzba.ch
Sun Dec 31 11:38:41 UTC 2017


On Sunday, 31 December 2017 at 07:16:46 UTC, Tim Hsu wrote:
> I came from C++ looking forward to D. Some languages require 
> programmers to use GC all the time. However, A lot of time we 
> don't really need GC especially when the time of destruction is 
> deterministic in compile time.
>
> [...]

You can use a custom toString method which doesn't do any 
allocations:

https://wiki.dlang.org/Defining_custom_print_format_specifiers

However, the building blocks (formattedWrite and writeln) aren't 
"@nogc" at the moment.


More information about the Digitalmars-d-learn mailing list