comp.lang.ada
 help / color / mirror / Atom feed
* Size of CHARACTER in Ada 83
@ 1996-08-30  0:00 James Squire
  1996-08-31  0:00 ` Robert Dewar
  0 siblings, 1 reply; 4+ messages in thread
From: James Squire @ 1996-08-30  0:00 UTC (permalink / raw)
  Cc: ara, TEAM-ADA


I'm momentarily at my wits end and was just wondering if anyone can help.

We just upgraded an Ada 83 compiler to a new version, and old code such 
as this:

   Mumble : constant array(CHARACTER'FIRST .. CHARACTER'LAST) := <128 
value aggregate>;

no longer compiles as it once did.  The compiler we are using (which I 
don't want to specify - it's not the issue anyway) now complains that the 
sizes of the arrays are different and this code will raise a 
CONSTRAINT_ERROR.

I was sure this was a bug (it was reported as such) since the only other 
conclusion was that the size of CHARACTER had changed, and I thought, 
"how can that be?"

I have since been informed that somewhere in the Annotated Ada (83) 
Reference Manual, there is an AI (Ada Interpretation) which allows 
CHARACTER to have 256 values.  This new compiler version made the change, 
anticipating Ada 95.  My problem is that the above code is generated by 
ALEX.

Is the AARM for Ada 83 out on the Web anywhere?  I don't think we have 
one.  I would like to satisfy myself that this is appropriate (it's 
certainly not allowed by the LRM, at least by my reading).  If not, can 
anyone enlighten me as to what the vendor is required to do if they 
choose to make this change?

It seems to me that those who want a 256 value CHARACTER should have to 
change their code rather than me change mine, but I have this funny 
feeling the case is "moot" (with apologies to Robert Dewar or whoever 
that was that was complaining about improper usage of that word).  Is it?

If so, my only options seem to be to try to change my .L file or exercise 
some option in processing it, so that more portable code is generated (I 
have my doubts about this one) or else live with manually changing the 
code each time I regenerate it.  Actually the third option is to not use 
the new compiler version but stick with the previous version which 
compiled it "correctly".

Is this truly what I am left with?  Are there versions of ALEX that would 
generate "proper code" for me?
-- 
James Squire                             mailto:jsquire@mdc.com
MDA Avionics Tools & Processes
McDonnell Douglas Aerospace              http://www.mdc.com/
Opinions expressed here are my own and NOT my company's
"Beep. Beep."
	-- Garibaldi (to G'Kar), "The Gathering"




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Size of CHARACTER in Ada 83
  1996-08-30  0:00 Size of CHARACTER in Ada 83 James Squire
@ 1996-08-31  0:00 ` Robert Dewar
  1996-09-01  0:00   ` John Herro
  1996-09-01  0:00   ` James Squire
  0 siblings, 2 replies; 4+ messages in thread
From: Robert Dewar @ 1996-08-31  0:00 UTC (permalink / raw)



"It seems to me that those who want a 256 value CHARACTER should have to
change their code rather than me change mine, but I have this funny
feeling the case is "moot" (with apologies to Robert Dewar or whoever
that was that was complaining about improper usage of that word).  Is it?"

Well it is certainly not a moot issue, because it has been officially
decided that Character will always be 256 values (by the ISO standards
group producing the Ada 95 standard), and that it may optionally be
256 values in Ada 83 (by the Zandfoort meeting of WG9, affirming
the AI you mention) [moot means arguable, undecided].

I think the compiler writer who changed to 256 characters was doing 
the right thing. Rational in particular has I believe made this change,
and particularly wanted to do so, since the 128 character limitation
was a real problem for them, esp3ecially in Europe, and I think that
Rational certainly made the right decision.

If you really want a 128 value character type, define it yourself

  type My_Char is new Character range Character'Val(0) .. Character'Val(127);

that will work in all versions of Ada.

But shouldn't you really change your program? Any program that restricts
charcters to 128 values these days is obsolescent it seems to me.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Size of CHARACTER in Ada 83
  1996-08-31  0:00 ` Robert Dewar
@ 1996-09-01  0:00   ` John Herro
  1996-09-01  0:00   ` James Squire
  1 sibling, 0 replies; 4+ messages in thread
From: John Herro @ 1996-09-01  0:00 UTC (permalink / raw)



dewar@cs.nyu.edu (Robert Dewar) writes:
> If you really want a 128 value character type,
> define it yourself
>    type My_Char is new Character range Character'Val(0) ..
Character'Val(127);
> that will work in all versions of Ada.
> But ... any program that restricts charcters to 128
> values these days is obsolescent, it seems to me.
     Well, I can think of a reason for wanting to restrict a program to
the lower 128 characters.  The high characters look different on different
terminals.  For example, the box drawing characters on a PC in text mode
look entirely different on a VT102.
     In my Ada Tutor program, I use only characters 32 through 126,
drawing boxes with plus signs, minus signs, and vertical bars.  Although
the box drawing characters would be much nicer, my text looks the same on
different platforms.  Here we're talking about portability not among
different Ada compilers, but among different *terminals*.
   An alternative to Robert's suggestion is to write "*SUBTYPE* My_Char is
Character range ... ."  Then (with any version of Ada), you'll be able to
use Text_IO.
- John Herro
Software Innovations Technology
http://members.aol.com/AdaTutor
ftp://members.aol.com/AdaTutor




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Size of CHARACTER in Ada 83
  1996-08-31  0:00 ` Robert Dewar
  1996-09-01  0:00   ` John Herro
@ 1996-09-01  0:00   ` James Squire
  1 sibling, 0 replies; 4+ messages in thread
From: James Squire @ 1996-09-01  0:00 UTC (permalink / raw)



Robert Dewar wrote:
> 
> "It seems to me that those who want a 256 value CHARACTER should have to
> change their code rather than me change mine, but I have this funny
> feeling the case is "moot" (with apologies to Robert Dewar or whoever
> that was that was complaining about improper usage of that word).  Is it?"
> 
> Well it is certainly not a moot issue, because it has been officially
> decided that Character will always be 256 values (by the ISO standards

I believe that is exactly what I said.  Don't you remember the argument 
about "moot" = "officially decided"?????  I was trying to tip my cap to 
you because you use the word differently (I think it was you), but to me 
and everyone I have ever known, that is what "moot" means.

> group producing the Ada 95 standard), and that it may optionally be
> 256 values in Ada 83 (by the Zandfoort meeting of WG9, affirming
> the AI you mention) [moot means arguable, undecided].

See above.

> I think the compiler writer who changed to 256 characters was doing
> the right thing. Rational in particular has I believe made this change,
> and particularly wanted to do so, since the 128 character limitation
> was a real problem for them, esp3ecially in Europe, and I think that
> Rational certainly made the right decision.

I have been informed of this by the vendor in question, and retracted my 
hard line statement about how those who want 256 characters should have 
to change.

> If you really want a 128 value character type, define it yourself
> 
>   type My_Char is new Character range Character'Val(0) .. Character'Val(127);
> 
> that will work in all versions of Ada.
> 
> But shouldn't you really change your program? Any program that restricts
> charcters to 128 values these days is obsolescent it seems to me.

You completely missed one statement in my post:  "The problem is that 
this code is generated by ALEX".  As I just told someone else privately, 
I could have figured this out all by myself.  My whole reason for posting 
was to find out if there was something I could do OTHER than manually 
modifying code that is automatically generated by a tool.
-- 
James Squire                             mailto:jsquire@mdc.com
MDA Avionics Tools & Processes
McDonnell Douglas Aerospace              http://www.mdc.com/
Opinions expressed here are my own and NOT my company's
"Commander, this little breach of security isn't going to affect my
 Christmas bonus, is it?"
	-- Garibaldi, "The Gathering"




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1996-09-01  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-08-30  0:00 Size of CHARACTER in Ada 83 James Squire
1996-08-31  0:00 ` Robert Dewar
1996-09-01  0:00   ` John Herro
1996-09-01  0:00   ` James Squire

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