[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] Undefined evaluation order in C generated code (in primitiveSetOrHasIdentityHash) (#596)
notifications at github.com
Fri Sep 17 13:31:09 UTC 2021
Note that there is another such warning coming from here:
I thought that the warning could be abusive see https://stackoverflow.com/questions/69223499/does-the-following-pre-increment-expression-really-result-in-unsequenced-modific but it is not!
We could find a compiler that would output `bufferIndex == 2` and still comply with the standard.
The funny thing is that the same construct is now well defined in recent C++11 and later, where assignment has become a sequence point. You C guys are running crazy!
Anyway, in doubt, and in order to avoid future reviewing cost of warnings I suggest a simple rewrite.
My understanding is that we want to flip/flop (double buffer) but we should write either a simple
playBufferIndex ^= 1;
playBufferIndex = 1 - playBufferIndex ;
playBufferIndex = (playBufferIndex + 1) & 1;
if we want to deal with not properly initialized `playBufferIndex` (not the case in current code, there is proper initialization of the variable).
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Vm-dev