short s, t; t = -s: no (longer) works: Deprecation: integral promotion not done for -s, use

ixid adamsibson at gmail.com
Sat Feb 24 23:33:21 UTC 2018


On Saturday, 24 February 2018 at 20:07:04 UTC, kdevel wrote:
> I don't get the point of the deprecation message:
>
> --- intprom.d
> import std.stdio;
>
> void main ()
> {
>    short s, t;
>    t = -s;
> }
> ---
>
> $ dmd intprom.d
> intprom.d(6): Deprecation: integral promotion not done for -s, 
> use '-transition=intpromote' switch or -cast(int)(s)
>
> What shall I do in order to get my template code
>
> void mymain (T) ()
> {
>    :
>       b[i] = -b [i];
>    :
> }
>
> compiled for any type for which negation is defined?

It's ridiculous and is going to cause endless pain and spammed or 
forgotten casts in generic code. It will turn off newbies to D.


More information about the Digitalmars-d-learn mailing list