Changeing return type of struct.toString()
smjg_1998 at yahoo.com
Sun Feb 12 16:21:38 PST 2012
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?
More information about the Digitalmars-d