Negating a short?

Dennis dkorpel at gmail.com
Tue Nov 5 19:37:32 UTC 2024


On Tuesday, 5 November 2024 at 17:32:00 UTC, Andy Valencia wrote:
> I ended up with this, but is negating a short really this 
> problematic, or did I miss something?

This is a relic from when integer promotion was added to unary 
operators to match the behavior of C compilers. You can add the 
`-preview=intpromote` flag to the compiler to make the 
deprecation warnings go away for a simple `-x`, but that flag is 
enabled by default since dmd version 2.099 / ldc version 1.29, so 
simply updating your compiler should also fix it.


More information about the Digitalmars-d-learn mailing list