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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1f0967a619e5d83e X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wn14feed!worldnet.att.net!bgtnsc04-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: Ada checks suppression thanks to compilation options and Ada conformity Reply-To: anon@anon.org (anon) References: <4733972C.C7E7BCE@free.fr> X-Newsreader: IBM NewsReader/2 2.0 Message-ID: Date: Fri, 09 Nov 2007 06:07:41 GMT NNTP-Posting-Host: 12.65.6.25 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc04-news.ops.worldnet.att.net 1194588461 12.65.6.25 (Fri, 09 Nov 2007 06:07:41 GMT) NNTP-Posting-Date: Fri, 09 Nov 2007 06:07:41 GMT Organization: AT&T Worldnet Xref: g2news1.google.com comp.lang.ada:18226 Date: 2007-11-09T06:07:41+00:00 List-Id: Even though your program may or may not be coded to raise a CONSTRAINT_ERROR or NUMERIC_ERROR, other functions and packages may use them or the hardware may raise them. Since the Suppress and Restrictions pragmas are apart of the Ada Standards, then they are not a way of getting around Ada norms. Ada unlike other languages has a few extra features built-in, which can be used for testing and debugging. So during the development phase a programmer may use the normal build-in error checking and exceptions while testing a routine and then later add programmer defined validation when and as needed. Then once the routine is tested the build-in error checking can be removed to save execution time and space. Embedded devices such as cell phones or pdas are an example of where saving time and space is high on a programmer list. Because most Cell phones and PDAs have limited memory and both have slower clock speeds. So any time saving and space reducing method must be used in these devices. Plus, in device driver routines the data should be validated before it is to and from the data buffer and program. But the transfer between the data buffer and the actual device the checking needs to be removed. Or these checks may cause either over or under runs for the transfer of data. Also, once the data is validated at the entry or creation point it does not need to be validated at each routine that handles the data unless that routine alters the data. Another example is accessing the co-processors like the FPU. If the FPU does a divide, the only thing that happens is the correct FPU status flags are set and the normal FPU interrupt. Now if the FPU does a divide-by-zero the only different is that the divide-by-zero status flag is set. It may or may not use the divide-by-zero CPU interrupt, but the CONSTRAINT_ERROR usage is software controlled. -- -- a.adb -- -- -- Uncomment either or both: -- -- pragma Suppress ( All_Checks ) ; -- pragma Restrictions ( No_Exceptions ) ; with Ada.Text_IO ; procedure a is b : string ( 1..1 ) ; -- c : integer := 0 ; -- d : integer := 1 ; -- e : integer := 2 ; c : float := 0.0 ; d : float := 1.0 ; e : float := 2.0 ; begin -- a Ada.text_io.put_line ( "Assign B" ) ; b := "55" ; -- Should cause a Constraint_Error -- either pragma : allow code to continue Ada.text_io.put_line ( "Perform Divide by Zero" ) ; e := d / c ; -- Should cause a Constraint_Error -- either pragma : allows code to continue for FPU -- float instruction but a core dump -- may result for CPU integer divide Ada.text_io.put_line ( "End of Job" ) ; end a ; In <4733972C.C7E7BCE@free.fr>, Christophe TRAVERS writes: >I send this message in order to get your opinion on the following >subject : > >An Ada program was supposed to take into account the Ada exceptions : >CONSTRAINT_ERROR, NUMERIC_ERROR, ... >The pragma SUPPRESS was forbidden. So, it was not used in the Ada source >code. >Everybody was convinced that the exception mechanism was fully >operational in the embedded object executable. > >Nevertheless, the object code was compiled thanks to the Ada TARTAN >compiler with some compilation options have suppressed all the "checks" >in the entire object code. > >>From my point of view, these compilation options that can suppress the >checks are a way to get around the Ada language norm. > >What it you opinion on this suject?. > >Sincerely. > > > > > >