comp.lang.ada
 help / color / mirror / Atom feed
From: colbert@hermix.UUCP (colbert)
Subject: Re: Characters with codes >= 128
Date: Wed, 9-Sep-87 23:47:24 EDT	[thread overview]
Date: Wed Sep  9 23:47:24 1987
Message-ID: <8709100440.AA04224@rand-unix.rand.org> (raw)


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.

             reply	other threads:[~1987-09-10  3:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1987-09-10  3:47 colbert [this message]
1987-09-10 18:39 ` Characters with codes >= 128 Barry Margolin
1987-09-12 14:47 ` Erland Sommarskog
  -- strict thread matches above, loose matches on Subject: below --
1987-09-14 14:28 characters " Jim Moody, DCA C342
1987-09-15 20:55 ` Erland Sommarskog
1987-09-10 12:51 Characters " "MARTIN J. MOORE"
1987-09-09 13:29 Jim Moody, DCA C342
1987-09-02  2:35 OCharacters " colbert
1987-09-05 20:43 ` Characters " sommar
1987-08-31 20:47 "MARTIN J. MOORE"
1987-08-30 21:28 sommar
1987-09-02 14:24 ` stt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox