D implements post-increment/decrement with a lowered expression.
According to the docs; (auto t = val, ++val, t)
I'm implementing C++'s atomic<T> type, which implements `operator++` & `operator--`, but I realised that the lowering is not atomic, and I seem to have no way to implement the post-inc/dec operators explicitly such that I can make them atomic.
To properly implement this library, I need a way to implement the post-int/dec operators explicitly.
Comment #1 by turkeyman — 2019-08-12T03:19:25Z
Or a way to @disable the post-inc/dec semantics explicitly, so that I can implement pre-inc/dec without opening the door for a race on the lowering.
Comment #2 by dlang-bot — 2021-03-24T05:42:32Z
@thewilsonator updated dlang/dmd pull request #12301 "Fix issue20123 by allowing opUnaryRight to disable post-[inc|dec]rement" fixing this issue:
- Fix issue 20123 by allowing opUnaryRight to disable post-[inc|dec]rement
https://github.com/dlang/dmd/pull/12301
Comment #3 by robert.schadek — 2024-12-13T19:04:50Z