signed/unsigned integer conversion for right shift seems
Peter T. Breuer
ptb@inv.it.uc3m.es
Wed Feb 7 09:59:00 GMT 2018
"Also sprach Jonathan Wakely:"
>
> On 6 February 2018 at 20:08, Tadeus Prastowo wrote:
> > Jonathan is not attacking you.
>
> Well I am now, because he's insisting on continuing his off-topic
> wanderings through the C standard.
The question is if gcc is following the C standard.
You are counselled not to do the attacking thing, unless you would like
to be e-sat on and e-fingered by the e-police, or just generally
villified and derided as that e-wit throughout the Internet and the
e-iverse in general.
To summarize what we know:
6.1.3.8 of many C standards contains a list of for what operators
conversions should be applied "automatically", which means "without a
cast", which means "implicitly". That list is prescriptive except
inasmuch as it is countermanded and/or overridden by the one-by-one
details of the operators in 6.5. There is nothing else that applies, as
the authority at the start of section 6.1 says.
That is all.
In the case that I used to exemplify the situation, there are no
promotions (ints are already the args) and there are no conversions
because >> is not listed for conversions in 6.1.3.8 AND its own
paragraph in 6.5 does not say "conversions" (it says "promotions"
instead) AND 6.1 says that is all.
Done.
Exercise - try it with long long int in place of int.
Thank you for your contribution.
Regards
PTB
More information about the Gcc-help
mailing list