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.7 required=5.0 tests=BAYES_00,INVALID_DATE, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!bbn!oberon!cit-vax!ucla-cs!zen!ucbvax!hermix.UUCP!colbert From: colbert@hermix.UUCP (colbert) Newsgroups: comp.lang.ada Subject: Re: Characters with codes >= 128 Message-ID: <8709100440.AA04224@rand-unix.rand.org> Date: Wed, 9-Sep-87 23:47:24 EDT Article-I.D.: rand-uni.8709100440.AA04224 Posted: Wed Sep 9 23:47:24 1987 Date-Received: Sat, 12-Sep-87 04:35:05 EDT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: hermix!colbert@rand-unix.ARPA Organization: The ARPA Internet List-Id: In response to my answer to his question about character types sommar@seismo.css.gov (Erland Sommarskog) writes: >I think Martin Moore's solution was much more simple and elegant. It will >work on any Ada system that doesn't check character assignments for >Constraint_error. > This solution requires one hell lot of work and it isn't portable from >OS to another. Yes, I can write my own Text_IO, but guess how fun I find >that. And, I will have to write one Text_IO for each OS I want to work >with. Guess why there is a standard Text_IO. It gives you a standard >interface. Unfortunately, Martin Moore's solution is NOT portable either. It only works because: 1) Unchecked_Conversion is implemented in DEC Ada. 2) The size of type Character objects in DEC is 8 bits. 3) DEC did not give a Constraint_Error on the assignemt (which may be a bug in DEC's implementation). 4) DEC does not "place restrictions on unchecked conversions" (13.10.2 P2); 5) DEC truncates high order bits if the source value if its size is greater than the size of the target type (this is really only a problem with the specific example given by Moore, in that he used the type Integer as the source type as opposed to an 8 bit type). The principle benefit of my proposed solution is the creation of a portable abstraction that represents the problem. Re-implementing a Text I/O for this type is a small price to pay for this benefit (especially when Moore's technique can be used in the implementation of this Text I/O - Sufficiently issolated to prevent major impact on the system that I'm implementing and later porting [as pointed out by another reader of this group]). Take Care, Ed Colbert hermix!colbert@rand-unix.arpa P.S. As an additional comment, at the recent SIGAda Conference, Dr. Dewer indicated that Unchecked_Conversion could be legally implemented to always return 0 no matter what the "value" of the source object was. I did not get a chance to full nail him down on what he ment by this comment, so may be he will respond to this message.