This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: signed/unsigned integer conversion for right shift seems
- From: Tadeus Prastowo <tadeus dot prastowo at unitn dot it>
- To: ptb at inv dot it dot uc3m dot es
- Cc: Jonathan Wakely <jwakely dot gcc at gmail dot com>, Liu Hao <lh_mouse at 126 dot com>, Peter dot T dot Breuer at gmail dot com, gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Tue, 6 Feb 2018 18:44:24 +0100
- Subject: Re: signed/unsigned integer conversion for right shift seems
- Authentication-results: sourceware.org; auth=none
- References: <CAH6eHdTaSSOaDXyi5-bmSmmVg+yiC7ax6XVvxGc+rWGaBS_iTQ@mail.gmail.com> <201802061719.w16HJ6i9020055@nbd.it.uc3m.es>
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