Re: Arithmetic shift operators: signedness

From: Shalom Bresticker (Shalom.Bresticker@motorola.com)
Date: Sun May 19 2002 - 04:09:25 PDT


Two comments, see below.

Shalom

Steven Sharp wrote:

> >Sec 4.1.12 says that a 0 or a signbit is filled in based on the signedness of
> the
> >result type. Later it says "The result signedness is .... and the remainder of
> the
> >expression as outlined in sec 4.5.1". However, I do not see the arith shift
> operators
> >listed in Table 29.
>
> They should be in the same entry as the other shifts. I believe this
> erratum was reported but not fixed before printing.

Yes, it is issue 18 in the database.

> >I would have thought that whether a 0 or a signbit is filled based solely on
> >the signedness of the first operand and nothing else.
>
> So will many other people. This is likely to lead to much misunderstanding
> of the behavior of signed arithmetic, but that is how it is defined. The
> behavior of sign-conversion matches the behavior of width-conversion, where
> all operands are converted before any operators are applied. This makes all
> conversions consistent within the language. The only problem is that most
> users don't know how the width conversion works to start with. It was
> designed to work the way it does precisely so they could get away with
> not knowing how it works and still get the expected results. The same is
> not true when the same conversion order is applied to signedness, but that
> is how it is.

Question on "The
behavior of sign-conversion matches the behavior of width-conversion":

As far as I can see, an expression width is determined also by its LHS whereas
its signedness is not. True?

Thanks,
Shalom

--
Shalom Bresticker                           Shalom.Bresticker@motorola.com
Design & Reuse Methodology                             Tel: +972 9 9522268
Motorola Semiconductor Israel, Ltd.                    Fax: +972 9 9522890
POB 2208, Herzlia 46120, ISRAEL                       Cell: +972 50 441478


This archive was generated by hypermail 2.1.4 : Mon Jul 08 2002 - 12:55:37 PDT and
sponsored by Boyd Technology, Inc.