July 04, 2013 Re: D vs C++ - Where are the benchmarks? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mehrdad | On Thu, Jul 04, 2013 at 11:20:47PM +0200, Mehrdad wrote: > On Thursday, 4 July 2013 at 21:11:57 UTC, Jonathan M Davis wrote: [...] > >My point was that it's perfectly possible to write C++ code which uses a GC, not that it was normal or easy. > > No, the point is that it would only with a particular C++ compiler. It's not "C++" code if a C++ compiler can't run it correctly. That would make it "a vendor-specific language similar to C++" code. Really? I thought there are conservative GC's out there for C++ (and even C, IIRC). It's not too much different from D's GC, actually. You just override malloc/free in the library (or operator new and operator delete, as the case may be), then have a GC thread scan the runtime stack for roots. Of course, only a conservative GC is possible, since you don't know what's a real pointer and what's just an integer value that happens to look like a pointer. But it's definitely possible. T -- Без труда не выловишь и рыбку из пруда. |
July 04, 2013 Re: D vs C++ - Where are the benchmarks? | ||||
---|---|---|---|---|
| ||||
Posted in reply to H. S. Teoh | On Thursday, 4 July 2013 at 22:28:18 UTC, H. S. Teoh wrote: > Really? I thought there are conservative GC's out there for C++ http://forum.dlang.org/thread/xjvlpegvhcwioqrjhzsn@forum.dlang.org?page=5#post-mwnwtdnbglcwoneqqoao:40forum.dlang.org |
July 04, 2013 Re: D vs C++ - Where are the benchmarks? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mehrdad | On Fri, Jul 05, 2013 at 01:45:24AM +0200, Mehrdad wrote: > On Thursday, 4 July 2013 at 22:28:18 UTC, H. S. Teoh wrote: > >Really? I thought there are conservative GC's out there for C++ > > > http://forum.dlang.org/thread/xjvlpegvhcwioqrjhzsn@forum.dlang.org?page=5#post-mwnwtdnbglcwoneqqoao:40forum.dlang.org http://en.wikipedia.org/wiki/Boehm_garbage_collector The GC doesn't need to be part of the language (though it's nice if it is). T -- "Uhh, I'm still not here." -- KD, while "away" on ICQ. |
July 05, 2013 Re: D vs C++ - Where are the benchmarks? | ||||
---|---|---|---|---|
| ||||
Posted in reply to H. S. Teoh | On Thursday, 4 July 2013 at 23:53:21 UTC, H. S. Teoh wrote:
> On Fri, Jul 05, 2013 at 01:45:24AM +0200, Mehrdad wrote:
>> On Thursday, 4 July 2013 at 22:28:18 UTC, H. S. Teoh wrote:
>> >Really? I thought there are conservative GC's out there for C++
>>
>>
>> http://forum.dlang.org/thread/xjvlpegvhcwioqrjhzsn@forum.dlang.org?page=5#post-mwnwtdnbglcwoneqqoao:40forum.dlang.org
>
> http://en.wikipedia.org/wiki/Boehm_garbage_collector
>
> The GC doesn't need to be part of the language (though it's nice if it
> is).
>
>
> T
And technically since C++11 a GC is part of the language, since there is now an official GC API on the runtime, even though it is optional to provide a real GC in current standard.
|
July 05, 2013 Re: D vs C++ - Where are the benchmarks? | ||||
---|---|---|---|---|
| ||||
Posted in reply to H. S. Teoh | On Thursday, 4 July 2013 at 23:53:21 UTC, H. S. Teoh wrote:
> On Fri, Jul 05, 2013 at 01:45:24AM +0200, Mehrdad wrote:
>> On Thursday, 4 July 2013 at 22:28:18 UTC, H. S. Teoh wrote:
>> >Really? I thought there are conservative GC's out there for C++
>>
>>
>> http://forum.dlang.org/thread/xjvlpegvhcwioqrjhzsn@forum.dlang.org?page=5#post-mwnwtdnbglcwoneqqoao:40forum.dlang.org
>
> http://en.wikipedia.org/wiki/Boehm_garbage_collector
>
> The GC doesn't need to be part of the language (though it's nice if it
> is).
>
>
> T
A _conservative_ GC doesn't. A _precise_ GC does.
|
July 05, 2013 Re: D vs C++ - Where are the benchmarks? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mehrdad | On 4 July 2013 22:03, Mehrdad <wfunction@hotmail.com> wrote:
> D, on the other hand, has a GC built into the language itself; it's not an implementation detail.
I'd say built into the runtime, rather than language. And it is an implementation detail on just how the GC tracks, allocates and collects memory. :)
--
Iain Buclaw
*(p < e ? p++ : p) = (c & 0x0f) + '0';
|
July 05, 2013 Re: D vs C++ - Where are the benchmarks? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mehrdad | On 4 July 2013 22:04, Mehrdad <wfunction@hotmail.com> wrote:
>
> To put it another way, _any_ conformant D compiler must necessarily have a GC.
>
Not necessarily true, but your application at runtime may leak surplus amounts of memory from hidden allocation calls without a GC. ;)
--
Iain Buclaw
*(p < e ? p++ : p) = (c & 0x0f) + '0';
|
Copyright © 1999-2021 by the D Language Foundation