Annoyance with new integer promotion deprecations

Nick Sabalausky (Abscissa) SeeWebsiteToContactMe at semitwist.com
Thu Feb 8 03:20:54 UTC 2018


On 02/06/2018 05:38 PM, Luís Marques wrote:
> 
> Yeah, it's annoying. For my MSP430 work (16-bit, lots of shorts and 
> bytes) I created a generic type which works around this, so you would do:
> 
> byte c = a.nx + b;
> 
> where .nx means "non-extending" and converts/wraps the (u)byte/(u)short 
> in my special type. The arithmetic operations are infectious, so you 
> only need to apply it to one of the operands (and you can preserve it 
> across statements by using "auto" instead of "byte").

Very cool. Would love to see this as a dub package.


More information about the Digitalmars-d mailing list