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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e01fe1b326df26d4 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Division by zero Date: 28 Jun 2005 17:22:27 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <79ahr0jozmqb$.10jzllrcjpmsv.dlg@40tude.net> <_pwre.7121$U4.1023104@news.xtra.co.nz> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1119993747 26239 192.74.137.71 (28 Jun 2005 21:22:27 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 28 Jun 2005 21:22:27 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:11708 Date: 2005-06-28T17:22:27-04:00 List-Id: "Lurker" writes: > "Robert A Duff" wrote in message > news:wccfyvm78k0.fsf@shell01.TheWorld.com... > > > Now I have a variable Gizmos, and I want to print out the > > numbers of Gizmos per Widget (when that's meaningful). > > In *portable* code, I might want to write: > > > > if Widgets = 0 then > > Put_Line("Unknown"); > > else > > Put_Line(Image(Gizmos/Widgets)); > > end if; > > > > If divide by zero were illegal at compile time, even in unreachable > > code, the above would be annoying illegal on Unix. > > Interesting example. I guess I'm taking it a bit on a tangent now > but how does that square off with RM 11.6.5 which says in part: > > ... The exception need be raised by the implementation only if, in the > absence of raising it, the value of this undefined result would have some > effect on the external interactions of the program ... > > Yes, I know it's just an implementation permission and so doesn't define > the language. Yet, the idea seems to be that if there is no possible > observable > effect then it's ok. Shouldn't the same logic apply in your example as well? 11.6(5) is all about run time effects. If divide by zero were illegal (which means at compile time), then 11.6 would not apply. 11.6 is also (as you said) all about implementation permissions -- i.e. not portable. I would hope a legality rule in this area would be portable. - Bob