Adding Java and C++ to the MQTT benchmarks or: How I Learned to Stop Worrying and Love the Garbage Collector
Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com>
Ola Fosheim Grøstad" <ola.fosheim.grostad+dlang at gmail.com>
Thu Jan 9 02:46:21 PST 2014
On Thursday, 9 January 2014 at 09:58:24 UTC, Walter Bright wrote:
> Please explain how this can work passing both string literals
> and allocated strings to cat().
By having your own string allocator that tests for membership
when you free (if you allow free and foreign strings in your cat)?
> How do you return a string that is the path part of a
> path/filename? (The terminating 0 is not a problem solved by
> creating your own allocator.)
If you discard the original you split at '/'. If you use your own
stringallocator you don't have to worry about free... You either
let the garbage remain until the pool is released or have a
separate allocation structure that allows internal splits (no
private size info before first char).
More information about the Digitalmars-d
mailing list