Annoyance with new integer promotion deprecations

Johan Engelen j at j.nl
Mon Feb 19 19:06:57 UTC 2018


On Sunday, 18 February 2018 at 20:01:39 UTC, Jonathan M Davis 
wrote:
> On Sunday, February 18, 2018 19:42:07 Johan Engelen via 
> Digitalmars-d wrote:
>> > There are hundreds of lines I need to molest to make the 
>> > compiler shut up. I won't type another line of code on my 
>> > colour library until this noise is gone... I will not 
>> > maintain it. I am emotionally incapable of assaulting my 
>> > code with those casts.
>>
>> Using the `-transition=intpromote` compile flag is no option 
>> for you?
>
> Since that's a transition flag, it's really only a stop-gap 
> solution. So, if his issue is that he doesn't like having the 
> casts in his code as opposed to not wanting to deal with 
> updating his code right now, the flag really doesn't help.

I thought Manu explicitly mentioned that he'd rather have 
possible code breakage than the deprecation message. I'm assuming 
in his case there will not be any breakage. Using 
`-transition=intpromote` will change to the C semantics and shuts 
up the deprecation messages. With time the semantics of 
`-transition=intpromote` will become the new default and the flag 
is no longer needed. So the flag is very helpful in avoiding 
having to adjust the code.

> I'd say that if he's not going to abandon his library, he 
> either needs to just grit his teeth and use the explicit casts, 
> or he's going to need to refactor the code so that the casts 
> are unnecessary.

I don't see how one would refactor `ubyte foo(ubyte a) { return 
-a; }` and improve things.

-Johan





More information about the Digitalmars-d mailing list