Is there any writeln like functions without GC?

Jonathan M Davis newsgroup.d at jmdavisprog.com
Sat Nov 2 22:48:05 UTC 2019


On Thursday, October 31, 2019 9:11:42 AM MDT Ferhat Kurtulmuş via 
Digitalmars-d-learn wrote:
> On Thursday, 31 October 2019 at 13:46:07 UTC, Adam D. Ruppe wrote:
> > On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote:
> >> Hi:
> >>    why writeln need GC?
> >
> > It almost never does, it just keeps the option open in case
> >
> > * it needs to throw an exception (like if stdout is closed)
> >
> > * you pass it a custom type with toString that uses GC
> >
> > @nogc is just super strict and doesn't even allow for rare
> > cases.
>
> It would be nice if one reimplement writeln of Phobos by
> bypassing gc and use a custom nogc exception as described here*?
> Of course I can imagine that it would be a breaking change in the
> language and requires so much work for it to be compatible with
> other std modules/language features.
>
> *:
> https://www.auburnsounds.com/blog/2016-11-10_Running-D-without-its-runtime
> .html

You can always just use printf.

- Jonathan M Davis






More information about the Digitalmars-d-learn mailing list