food for thought - swift 5 released - bottom types, string interpolation, and stuff.

Abdulhaq alynch4047 at gmail.com
Sat Apr 13 08:38:02 UTC 2019


On Saturday, 13 April 2019 at 05:37:31 UTC, Walter Bright wrote:
> On 4/12/2019 10:18 PM, H. S. Teoh wrote:
>> writing (x % 2) conveys intent much better
>> than (x & 1).
>
> They produced different code.

This is a non-sequitur, the fact that some compilers produce 
different assembly does not say anything about how well the 
functions convey intent.

However, in general, knowing that the bit-twiddling variety of a 
function produces different code to the mathematically precise 
expression, would just make me stop and think twice, three or 
even four times if just perhaps, it's better to stick to the 
mathematically precise and clear rendering of the desired 
algorithm.



More information about the Digitalmars-d mailing list