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,436ac666600e5ab3 X-Google-Attributes: gid103376,public From: "Jeffrey D. Cherry" Subject: Re: Exception Handling Date: 2000/06/02 Message-ID: <3937D0B9.C952A204@utech.net>#1/1 X-Deja-AN: 630251765 Content-Transfer-Encoding: 7bit References: <3HCY4.29157$sB3.10828@news.indigo.ie> <3933DAF3.35F40B3A@utech.net> <3936E41C.FCDE89D6@acm.org> X-Accept-Language: en,pdf Content-Type: text/plain; charset=us-ascii X-Trace: azure.impulse.net 959959389 196 207.154.67.27 Organization: Logicon MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-06-02T00:00:00+00:00 List-Id: Jeff Carter wrote: > > Ada provides at least 2 ways to check that a string contains an > appropriate representation of a floating-point number: 'Value and > Ada.Text_IO.Float_IO. Both convert the string to a floating-point value > and signal an invalid string by raising an exception. Whether you agree > that raising an exception is appropriate, why would you write another > subprogram to parse a string for a floating-point value when you can > reuse these existing, robust, and well-tested subprograms? Normally you would always use the available facilities to perform this kind of an operation. There are, however, rare situations where the Ada library facilities are not available. One example would be when developing an embedded application. The compiler vendor does not always supply a run-time library for the target processor. Another example would be a in a safety-critical application that requires certification of all the code, including the run-time library routines. In these cases, some compiler vendors don't supply the source for their run-time libraries, or it's too expensive to get a certified version of the run-time library and so the developer generates equivalent versions of the few run-time library routine they use in their application. (I must say that I've never experienced this situation with _Ada_ compiler vendors.) Bear in mind that these two examples have little or no bearing on the original example problem which read a string from standard input and converted it to a float value if there were no format errors on the input string. -- Regards, Jeffrey D. Cherry Senior IV&V Analyst Logicon Space and Information Operations Logicon Inc. a Northrop Grumman company