[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] compilation results with avr-gcc 4.8.3
From: |
Richard Weickelt |
Subject: |
Re: [avr-gcc-list] compilation results with avr-gcc 4.8.3 |
Date: |
Fri, 26 Sep 2014 10:44:47 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130330 Thunderbird/17.0.5 |
Hi,
>> Is it fair to conclude that the ~
>> operator, applied to an unsigned char, does produce an int as output
>> instead of the input type?
>
> Yes, this is exactly what the C standard promotion rules require.
>
> Well, to be exact, they *require* it behaves "as if" it were promoted
> to "int", so if the sign extension has no net effect to the result, it
> might be left out as well. So in that sense, it might be considered a
> "missed optimization" bug in GCC here, but it's probably always hard
> to catch all those situations well were the integer promotion could be
> bypassed.
I remember vaguely somebody's proposal on this list to write a C++ class for
unsigned char in order to "bypass" promotion rules. Has anyone tried that?
Just being curious.
Richard