Annoyance with new integer promotion deprecations

Simen Kjærås simen.kjaras at gmail.com
Mon Feb 5 21:38:23 UTC 2018


On Monday, 5 February 2018 at 21:21:47 UTC, H. S. Teoh wrote:
> On Mon, Feb 05, 2018 at 09:20:16PM +0000, Nick Sabalausky via 
> Digitalmars-d wrote:
>> But still, I thought we had value range propagation rules to 
>> avoid this sort of nonsense when possible (such as the example 
>> above)?
>
> VRP doesn't help when the code doesn't have compile-time known 
> values, such as in the non-reduced code my example snippet was 
> reduced from.

If you were negating a byte, the code does have compile-time 
known values, since there's a limit to what you can stuff into a 
byte. If you weren't, the warning is warranted. I will admit the 
case of -(-128) could throw it off, though.

--
   Simen


More information about the Digitalmars-d mailing list