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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,583275b6950bf4e6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-23 07:29:13 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!freenix!enst.fr!not-for-mail From: "Robert C. Leif" Newsgroups: comp.lang.ada Subject: RE: Quality systems (Was: Using Ada for device drivers? (Was: theAda mandate, and why it collapsed and died)) Date: Fri, 23 May 2003 07:28:27 -0700 Organization: ENST, France Message-ID: NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Trace: avanie.enst.fr 1053700153 55300 137.194.161.2 (23 May 2003 14:29:13 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Fri, 23 May 2003 14:29:13 +0000 (UTC) To: "'Randy Brukardt'" , Return-Path: X-Envelope-From: rleif@rleif.com X-Mailer: Microsoft Outlook, Build 11.0.4920 Thread-Index: AcMhJPwB4+cYdYGxSTGbfuWU2yRu2QABCkww In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: comp.lang.ada mail to news gateway List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:37692 Date: 2003-05-23T07:28:27-07:00 I agree. When one models instrument data, the possibility of undetected overflows has to be dealt with. Most of my data are unsigned 16 (0 to = 2**16) and 32 (0 to 2**32) bit numbers.=20 An example of the need for the use of Ada software for this type of data = in scientific software follows. Presently, my company, Newport Instruments, develops ultrasensitive tags for cell and clinical analysis. We have a special ultrasensitive camera to image cells stained with these tags. = Our final images are the summation of 1,000 to 10,000 individual images = produced by flashlamp excitation. The individual images have a resolution of 12 = bits. The C++ programmer, who wrote the imaging software for the company that provided the camera, summed them as 16 bit integers. Therefore, the = camera often produces nonrepresentational art instead of scientific data. This summer's project is to create Ada packages that directly interface with = the existing DCOM objects and use XForms as the GUI to store and display the images. Bob Leif -----Original Message----- From: Randy Brukardt [mailto:randy@rrsoftware.com]=20 Sent: Thursday, May 22, 2003 2:15 PM To: comp.lang.ada@ada.eu.org Robert A Duff wrote in message ... >Vinzent Hoefler writes: >> Currently this thing is written in assembly language, but if I'd ever >> reengineer that in Ada I'd definitely use a (non-binary) modular type >> for the index then (and an array with 16 entries instead). Of course, >> as you pointed out, I could do the modulo arithmetic by hand, but why >> if I can let the compiler handle it? > >Because it makes the code easier to understand if the "mod" is explicit. I agree, especially because the generated code for modular types is ugly. My personal opinion is that wrap-around semantics for unsigned types is a mistake. Ada is about safety, and there is no safety in 2+2=3D1. I thought and still think that we should have added unsigned integer types with overflow, and then had a special package with wrap-around types of the full sizes for those rare cases where you need such functionality. Virtually every time I use a modular type, I end up tracking down some bug at runtime that would have been caught had there been an overflow check. (Typically in the creation of an array index or the like.) Most of the these types are 'indexes' (handles) that have to fit in a particular size, and I often write checks like: if Index-1 > 0 then Index :=3D Index - 1; end if; which is wrong for a modular type. (Consider Index=3D0). Randy.