🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3524

Re: Integral promotion.

#3524
From: Russ Weathersby
Date: Sat, 24 Feb 1996 15:44
27 lines
1700 bytes
In <4gjd3g$nt9@solutions.solon.com>, encom@jolt.mpx.com.au (Encom Technology Sydney) writes:
:Re: short = short + short causing a warning.
:
:This is all getting off the track.  Since only a warning is generated this
:has very little to do with the standard.  I think the point is why does
:
:short = short + short;
:
:generate a warning whereas
:
:int = int + int;
:
:does not.  Both these statements are as prone to overflow as each other
:(although in the first case it may not happen until the int resulting
:from the addition is moved into the short if sizeof(int) > sizeof(short).
:
:The warning is even sillier since on the implementation mentioned
:ints and shorts are the same.

I do not own, nor have I read, a copy of the ANSI standard.  That said,
ints in my experience have 'special status' in that it is usually the
machine word size, sort of like an atomic data unit, whereas shorts
are an artificial construction.  Even though the two have the same size
in the example, this may nevertheless influence the behavior of the
compiler.

R.Weathersby
Technical Details
Message-ID: <4gnbpe$bmv@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4fstj7$2l6@solutions.solon.com> <4fvgvb$e0t@solutions.solon.com> <4gfgfp$3k8@solutions.solon.com> <4gjd3g$nt9@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: weather@netside.com (Russ Weathersby)
Newsgroups: comp.std.c,comp.lang.c.moderated
Subject: Re: Integral promotion.
Date: 24 Feb 1996 09:44:46 -0600
Organization: The Netside Network
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4gnbpe$bmv@solutions.solon.com>
References: <4fstj7$2l6@solutions.solon.com> <4fvgvb$e0t@solutions.solon.com> <4gfgfp$3k8@solutions.solon.com> <4gjd3g$nt9@solutions.solon.com>
Reply-To: weather@netside.com (Russ Weathersby)
NNTP-Posting-Host: solutions.solon.com
X-Newsreader: IBM NewsReader/2 v1.2