Changeing return type of struct.toString()
timon.gehr at gmx.ch
Sun Feb 12 16:26:05 PST 2012
On 02/13/2012 01:21 AM, Stewart Gordon wrote:
> On 12/02/2012 18:36, Benjamin Thaut wrote:
>> I'm currently trying to use D without a gc and didn't have major
>> problems so far. A minor
>> issues is that struct.toString() returns a string and this will almost
>> allways leak memory
>> when this is called.
>> The question now is, can I change the return type of struct.toString()
>> somewhere inside
>> druntime or is it hardcoded in the compiler?
> If you create a struct, you can declare a method called toString with
> whatever return type you want. Though it usually isn't a good idea.
> What, exactly, are you planning to do with this non-string string
> representation of a struct?
I suppose he wants to use a custom string type with deterministic memory
More information about the Digitalmars-d