From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fee8802cc3d8334d X-Google-Attributes: gid103376,public X-Google-Thread: 10a146,fee8802cc3d8334d X-Google-Attributes: gid10a146,public From: Tucker Taft Subject: Re: Ada and Java. different behaviour. casting long to int problem. Date: 1999/06/17 Message-ID: <37696EAB.E2226E2A@averstar.com>#1/1 X-Deja-AN: 490831426 Content-Transfer-Encoding: 7bit Sender: news@inmet.camb.inmet.com (USENET news) X-Nntp-Posting-Host: houdini.burl.averstar.com References: <7jt2c0$vrb@drn.newsguy.com> <7k57vb$1ipf@drn.newsguy.com> <3766650F.705125B7@pwfl.com> <7k64t7$igo$1@its.hooked.net> <7k689a$ci2@drn.newsguy.com> <3766C842.E1EAB60A@pwfl.com> <3766D1CC.D712895E@itools.symantec.com> <3767CDFC.798BBB23@cajunbro.com> <3767DF5C.5C4A79A@averstar.com> <37694D15.398D9B14@cajunbro.com> Content-Type: text/plain; charset=us-ascii Organization: AverStar (formerly Intermetrics) Burlington, MA USA Mime-Version: 1.0 Newsgroups: comp.lang.ada,comp.lang.java.programmer Date: 1999-06-17T00:00:00+00:00 List-Id: George W. Bayles wrote: > > Tucker Taft wrote: > > > [snip] > > The compiler can emit code to explicitly check the overflow condition > > (when needed), whereas the programmer may not have any easy or > > efficient way of writing such a check in the high-level language. > > > > > int a,b,c; > > > .... > > > a = b + c; > > > boolean overflowed = (c<0) ? (a>b) : (a > > > > > [snip] > > > Huh? This high level overflow check may not be terribly efficient but > it is easy enough. It is straightforward if all you have is an assignment with a single operation. However, potentially-overflowing arithmetic can occur anywhere, including in things like "i++" where significant rewriting would be required to insert a check. So that is what I meant by saying it was not "easy." I presume you agree with the efficiency issue. > > [snip] -- -Tucker Taft stt@averstar.com http://www.averstar.com/~stt/ Technical Director, Distributed IT Solutions (www.averstar.com/tools) AverStar (formerly Intermetrics, Inc.) Burlington, MA USA