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.6 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!seismo!rochester!pt.cs.cmu.edu!andrew.cmu.edu!ms8k# From: ms8k#@andrew.cmu.edu.UUCP Newsgroups: comp.lang.ada Subject: Re: language problem Message-ID: Date: Wed, 1-Apr-87 18:58:50 EST Article-I.D.: andrew.MS.V3.18.ms8k.80021103.harrisburg.ibm032.535.0 Posted: Wed Apr 1 18:58:50 1987 Date-Received: Sat, 4-Apr-87 09:04:55 EST Organization: Carnegie-Mellon University ReSent-Date: Wed, 1 Apr 87 18:59:23 est ReSent-From: postman#@andrew.cmu.edu ReSent-To: nntp-xmit#@andrew.cmu.edu Return-path: To: outnews#ext.nn.comp.lang.ada@andrew.cmu.edu List-Id: In article <8703261730.AA28726@taurus> amiram@TAURUS.BITNET.UUCP writes: >A colleague of mine, Yossi Veler of AITECH has come up with the following >program in Ada, which seems to create a serious problem. > >procedure boolsub is > subtype bool is boolean range true..true; > type arr is array(1..10) of bool; > a : arr := (1..10 => true); -- this seems like the only legal value >begin > a := not a; >-- Here a(1)=a(2)=...=a(10)= FALSE !!!! No exception occurs etc. > a := (1..10 => false); >-- This does cause an exception >end boolsub; > >The program seems legal : we inspected the LRM and also the implementers >guide, and we ran it on both the DDC and VERDIX compilers. It seems that >a combination of innocent features in Ada produces a result that seems to >contradict with the basic philosophy of the language, that is an object >posseses a value which is not in the appropriate type. Verdix Ada v1.5 is completely bogus. Don't be amazed by problems like this. Another example is type BYTE is range 0 .. 255; for BYTE'SIZE use 8; Verdix compiler says that the size is too small. type BYTE is new POSITIVE range 0 .. 255; for BYTE'SIZE use 8; same thing! 0 as a POSITIVE does not disturb it. The bit sign is still there. type BYTE is range -128 .. 127 for BYTE'SIZE use 8; is ok (at last), but is not really what was wanted. Another solution may be an enumaration of 256 items, a little painful. ____________________________________________________________ Marc A. Scheurer Arpanet, Bitnet: ms8k@andrew.cmu.edu UUCP : seismo!andrew.cmu.edu!ms8k ____________________________________________________________