Adding Java and C++ to the MQTT benchmarks or: How I Learned to Stop Worrying and Love the Garbage Collector

Walter Bright newshound2 at digitalmars.com
Thu Jan 9 01:58:23 PST 2014


On 1/9/2014 12:40 AM, "Ola Fosheim Grøstad" 
<ola.fosheim.grostad+dlang at gmail.com>" wrote:
> On Thursday, 9 January 2014 at 07:07:29 UTC, Walter Bright wrote:
>> and it works without copying in D, it just returns s1. In C, I gotta copy,
>> ALWAYS.
>
> Only if you write libraries, in an application you can set your own policies
> (invariants).

Please explain how this can work passing both string literals and allocated 
strings to cat().


>> (C's strings being 0 terminated also forces much extra copying, but that's
>> another topic.)
>
> Not if you have your own allocator and split chopped strings (you can just
> overwrite the boundary character).

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.)



More information about the Digitalmars-d mailing list