Ruling out arbitrary cost copy construction?
Michel Fortin
michel.fortin at michelf.com
Wed Oct 6 12:09:32 PDT 2010
On 2010-10-06 12:34:54 -0400, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> said:
> 2. It would force certain types (such as BigInt) that allocate
> resources and have value semantics to resort to reference counting.
Also, before asking for more reference counting, perhaps you should
check that bug and find a nice way to do reference counting correctly
with no race conditions (unlike what's done in Phobos currently).
<http://d.puremagic.com/issues/show_bug.cgi?id=4624>
The most problematic thing with reference-counted memory is that the GC
can call your struct's destructor from any thread which can cause
low-level races if the reference counter isn't manipulated with atomic
operations. And atomic operations slow things down, are you sure you
want to force this in BigInt?
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list