toString refactor in druntime

Martin Nowak via Digitalmars-d digitalmars-d at puremagic.com
Fri Oct 31 04:36:57 PDT 2014


On Tuesday, 28 October 2014 at 23:06:32 UTC, Manu via 
Digitalmars-d wrote:
> Video games consoles are very real, and very now.

What architecture/platform?
The indirect function call argument seems a bit displaced for 
toString.

>> This puts the burden on the caller to ensure enough space is 
>> allocated. Or
>> you have to reenter the function to finish up the output. 
>> Neither of these
>> seem like acceptable drawbacks.
>
> Well that's why I open for discussion. I'm sure there's room for
> creativity here.

Well the obvious alternative is a printf style return, that tells 
you how much space is needed.

> It doesn't seem that unreasonable to reenter the function to me
> actually, I'd prefer a second static call in the rare event 
> that a
> buffer wasn't big enough,

Second virtual call ;).


More information about the Digitalmars-d mailing list