On Wednesday, 1 October 2014 at 01:26:45 UTC, Manu via
Digitalmars-d wrote:
On 30 September 2014 08:04, Andrei Alexandrescu via Digitalmars-d
<digitalmars-d@puremagic.com> wrote:
On 9/29/14, 10:16 AM, Paulo Pinto wrote:

Personally, I would go just for (b) with compiler support for
increment/decrement removal, as I think it will be too complex having to
support everything and this will complicate all libraries.


Compiler already knows (after inlining) that ++i and --i cancel each other,
so we should be in good shape there. -- Andrei

The compiler doesn't know that MyLibrary_AddRef(Thing *t); and
MyLibrary_DecRef(Thing *t); cancel eachother out though...
rc needs primitives that the compiler understands implicitly, so that
rc logic can be more complex than ++i/--i;

Even with simply i++ and i--, the information that they always go
by pair is lost on the compiler in many cases.

Reply via email to