comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@schonberg.cs.nyu.edu (Robert Dewar)
Subject: Re: help: character to integer
Date: 1996/10/05
Date: 1996-10-05T00:00:00+00:00	[thread overview]
Message-ID: <dewar.844516356@schonberg> (raw)
In-Reply-To: 3252BEC8.529E@lmco.com


iGeorge said

"   Forgive my ignorance, but is there any guarantee that
Character'POS('X') = {ASCII code for 'X'}?  Especially now that Ada uses
ISO Latin-1 (or whatever the standard actually calls for).  Are ASCII
and Latin-1 two names for the same standard?  (I assume that they are at
least equivalent for "well-behaved" characters as the solution probably
works empirically.){"


ASCII is essentially an obsolete standard at this point. For all practical
purposes, ASCII is equivalent to the lower 128 characters of Latin-1, and
so for example, the answer to your question about 'X' is a definite yes.

Unlike other languages, the type Character is well defined in Ada, and
not subject to host/target considerations (for example, even on an EBCDIC
machine, an Ada compiler would provide a type Character matching Latin-1)

So there is nothing empirical here, the behavior is completely well defined
by the reference manual.

The reason that I say "for all practical purposes" is that ASCII is a little
bit fuzzy, especially if you roam around different countries. ASCII is 
actually a specialized US version of an (obsolete) international standard
that allows variations from country to country. Some symbols, like $ :-)
are international. But for example, the symbol for 16#23# which is # in
the US version, is the pound stirling symbol in the UK (this is why # on
a US touch tone phone is called the pound key).

Latin-1 on the other hand does not have national variations. This means that
if you are in say Sweden, people will think of ASCII as having symbols for
letters like A-circle. This is not quite correct thinking, because it is not
ASCII anymore, but in any case all these problems disappear when using
Latin-1.

Note: although Latin-1 support is required, Ada compilers may allow
localization options for different character sets. For example the GNMAT
compiler itself allows the following character sets for Ada identifiers

Latin-1
Latin-2
Latin-3
Latin-4
IBM PC (standard US version)
IBM PC code page 850 (European version)
Full upper half

We currently don't provide corresponding library packages for
the children of Ada.Characters for these sets, but we could (if anyone
really needed them, I wonder if anyone using Ada uses Latin-2 or Latin-4???)

But in standard mode, Latin-1 is the set, and you can count on it.





  parent reply	other threads:[~1996-10-05  0:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-10-01  0:00 help: character to integer Eric Anthony Spear
1996-10-02  0:00 ` Richard A. O'Keefe
1996-10-02  0:00   ` George Haddad
1996-10-02  0:00     ` David C. Hoos, Sr.
1996-10-02  0:00     ` Robert A Duff
1996-10-05  0:00     ` Robert Dewar [this message]
1996-10-07  0:00       ` the term "pound sign" (was: help: character to integer) Adam Beneschan
1996-10-09  0:00         ` Michael Feldman
1996-10-09  0:00           ` Robert Dewar
1996-10-09  0:00             ` Michael Feldman
1996-10-10  0:00             ` Richard Kenner
1996-10-10  0:00               ` Adam Beneschan
1996-10-11  0:00           ` Robert I. Eachus
1996-10-11  0:00             ` Robert Dewar
1996-10-02  0:00 ` help: character to integer Dave Marshall
1996-10-07  0:00 ` Paul Tongue
replies disabled

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