This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: signed/unsigned integer conversion for right shift seems


On Tue, Feb 6, 2018 at 6:19 PM, Peter T. Breuer <ptb@inv.it.uc3m.es> wrote:

[...]

> BTW, NOT saying something is applied in a specification should not mean
> that it is forbidden, as a general principle of specification languages.
> Is there somewhere in the C specification general blurb that says "no
> say, no do"?

[...]

> where it says that conversion MAY NOT or MUST
> NOT be applied to the arguments of >>.

Let's assume you could do one or more conversions as you wish.  But,
certainly you know you have to follow the spec, don't you?  Now the
specification of ISO-IEC 1989:1999 says in Section 6.5.7 Paragraph 3:
"The integer promotions are performed on each of the operands. The
type of the result is that of the promoted left operand."

Now, where do you want to perform your desired conversion?  Point A:
before "The integer promotions are performed on each of the operands"?
 Point B: before "The type of the result is that of the promoted left
operand"?  Point C: after "The type of the result is that of the
promoted left operand"?  Or any other point I have not mentioned?  Or
at two or more points that I have mentioned?

Try it for yourself if you can do one or more conversions at any of
the points I have mentioned without breaking the other part of the
spec.  So, if there is no loophole, a good spec shall not mention any
other extra thing, shall it?

> Regards and thanks
>
> PTB

--
Best regards,
Tadeus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]