Negating a short?

Matheus matheus at gmail.com
Wed Nov 6 19:17:06 UTC 2024


On Wednesday, 6 November 2024 at 16:27:22 UTC, Dennis wrote:
> On Wednesday, 6 November 2024 at 11:51:41 UTC, Matheus wrote:
>> Shouldn't these two act the same?
>
> That would make sense, but you wouldn't make a special case 
> just for that specific expression, and it's hard to find a good 
> rule that generalizes to all expressions.

I thought that internally:

i *= -1;

Would be expanded as:

i = i * -1;

And from the expanded version it would generate the same 
Assembly/Machine Code and follow the same rules.

Thanks,

Matheus.


More information about the Digitalmars-d-learn mailing list