Deprecate implicit conversion between signed and unsigned integers

Quirin Schroll qs.il.paperinik at gmail.com
Wed Feb 5 11:43:37 UTC 2025


On Monday, 3 February 2025 at 19:30:14 UTC, Paul Backus wrote:
> On Monday, 3 February 2025 at 18:40:20 UTC, Atila Neves wrote:
>> https://forum.dlang.org/post/pbhjffbxdqpdwtmcbikh@forum.dlang.org
>>
>> On Sunday, 12 May 2024 at 13:32:36 UTC, Paul Backus wrote:
>>> D inherited these implicit conversions from C and C++, where 
>>> they are widely regarded as a source of bugs.
>>>
>>> [...]
>>
>> My bias is to not like any implicit conversions of any kind, 
>> but I'm not sure I can convince Walter of that.
>
> That's why I focused my proposal on the specific conversions 
> that are the most error-prone. I don't think we'll ever 
> convince Walter to get rid of integer promotion in general, but 
> there's a chance we can convince him to get rid of these 
> specific conversions.

Those are annoying, yes. Especially unary operators. If you asked 
me right now what `~x` returns on a small integer type, I 
honestly don’t know.

D has C’s rules because of one design decision early on: If it 
looks like C, it acts like C or it’s an error.


More information about the dip.ideas mailing list