Why does intpromote spew warnings for ~ operator?
Guillaume Piolat
first.last at gmail.com
Tue Sep 14 07:31:17 UTC 2021
On Monday, 13 September 2021 at 22:27:11 UTC, Alexey wrote:
>
> It's also not exactly clear why:
> 1. D should be backward compatible with C, which is 50 years
> old soon.
A lot of the current D ecosystem (that wants to be simple to
build) relies on translated C: bindings, and stuff like codecs
are especially hard to translate error-free.
So it is valuable to be backward compatible with C, in the sense
that a copy-paster C expression should work or not build.
Note that this isn't still the case, for example:
int fun(int[4] a)
{
// stuff
}
void foo()
{
int[4] b;
fun(a); // passed by value in D, passed by pointer in C
}
ImportC will help a lot here, for example if like me you'd like a
WebP decoder in pure D there are none, it is just too big to
translate.
> 2. why exactly somebody should copy / paste (how many?
> thousands?) many lines of code without thinking and rechecking.
> Probably D can't be and shouldn't be compatible with C / C++ to
> that distinct.
It's very labor intensive to translate C to D, and a little
mistake can bury the effort.
> 3. Is really backward comparability with C/C++ so important?
C and C++ are different languages, the one reason C++ has
succeeded is "C/C++", being able to compile C code.
More information about the Digitalmars-d
mailing list