Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

(unsigned long) (short)

0 views
Skip to first unread message

Dmitriy N. Vasilev

unread,
Sep 21, 1993, 4:58:05 PM9/21/93
to
I have a question about the integral expression casting.
What

(unsigned long) (short)

does really mean:

(unsigned long) (unsigned short) (short)

or

(unsigned long) (long) (short)

?

Dm.
--
Dm. Vasilev | "Free cheese can be found only in a mouse trap"
dmi...@aqm.com | <disclaimer.std> : QMS may not agree

Norman Diamond

unread,
Sep 21, 1993, 8:46:53 PM9/21/93
to
In article <1993Sep21.2...@imagen.com> dmi...@imagen.com (Dmitriy N. Vasilev) writes:
>What (unsigned long) (short)
>does really mean:
> (unsigned long) (unsigned short) (short)
>or (unsigned long) (long) (short)

(unsigned long) (long) (short) -- sometimes. ANSI Classic section
3.2.1.2, page 35 lines 21 to 27: "When a value with integral type is
converted to another integral type, if the value can be represented by
the new type, its value is unchanged. When a signed integer is converted
to an unsigned integer with equal or greater size, if the value of the
signed integer is nonnegative, its value is unchanged. Otherwise: if
the unsigned integer has greater size, the signed integer is first promoted
to the signed integer corresponding to the unsigned integer corresponding
to the unsigned integer; the value is converted to unsigned by adding to
it one greater than the largest number that can be represented in the
unsigned integer type."
--
<< If this were the company's opinion, I would not be allowed to post it. >>
A program in conformance will not tend to stay in conformance, because even if
it doesn't change, the standard will. Force = program size * destruction.
Every technical corrigendum is met by an equally troublesome new defect report.

Christopher R. Volpe

unread,
Sep 22, 1993, 9:25:07 AM9/22/93
to
In article <1993Sep21.2...@imagen.com>, dmi...@imagen.com (Dmitriy N. Vasilev) writes:
|> I have a question about the integral expression casting.
|> What
|>
|> (unsigned long) (short)
|>
|> does really mean:
|>
|> (unsigned long) (unsigned short) (short)
|>
|> or
|>
|> (unsigned long) (long) (short)

The latter.

|>
|> ?
|>
|> Dm.
|> --
|> Dm. Vasilev | "Free cheese can be found only in a mouse trap"
|> dmi...@aqm.com | <disclaimer.std> : QMS may not agree

--

Chris Volpe
G.E. Corporate R&D
vol...@crd.ge.com

0 new messages