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 10:34:57 PST 2014


On 1/9/2014 10:18 AM, "Ola Fosheim Grøstad" 
<ola.fosheim.grostad+dlang at gmail.com>" wrote:
> On Thursday, 9 January 2014 at 17:15:46 UTC, Walter Bright wrote:
>> How does that work when you pass it "hello"? allocated with malloc()?
>> basically any data that has mixed ancestry?
>
> Why would you do that? You would have to overload cat then.

So you agree that it won't work.

BTW, it happens all the time when dealing with strings. For example, dealing 
with filenames, file extensions, and paths. Components can come from the command 
line, string literals, malloc, slices, etc., all mixed up together.

Overloading doesn't work because a string literal and a string allocated by 
something else have the same type.


>> That doesn't work if you're passing strings with mixed ancestry.
>
> Well, you have to decide if you want to roll your own, use a framework or use
> the old C way.
>
> The point is more: you can make your own and make it C-compatible, and
> reasonably efficient.

My point is you can't avoid making the extra copies without GC in any reasonable 
way.



More information about the Digitalmars-d mailing list