[OT] The Usual Arithmetic Confusions

Petar Petar
Fri Jan 28 11:28:32 UTC 2022

On Friday, 28 January 2022 at 02:33:18 UTC, H. S. Teoh wrote:
> On Fri, Jan 28, 2022 at 02:15:51AM +0000, Paul Backus via 
> Digitalmars-d wrote:
>> https://shafik.github.io/c++/2021/12/30/usual_arithmetic_confusions.html
> [...]
>> Unfortunately, this is also one of the areas of D that comes 
>> directly from C, so D programmers have to watch out for these 
>> as well.
>> It's been argued in the past, on these forums, that these 
>> conversions are "just something you have to learn" if you want 
>> to do system-level programming. But if C++ programmers are 
>> still getting this stuff wrong, after all these years, perhaps 
>> the programmers aren't the problem. Is it possible that these 
>> implicit conversions are just too inherently error-prone for 
>> programmers to reliably use correctly?
> I agree.  The question, though, is how to convince Walter. :-P
> T

Now that we have importC, the argument for easier porting C to D 
code is less valid. D no longer needs to closely follow the usual 
arithmetic "confusions" of C, just so that some C code can have 
the same meaning when copied to D. I prefer to get compliler 
errors when porting C to D than preserving the landmines from the 
original code.

More information about the Digitalmars-d mailing list