comp.lang.ada
 help / color / mirror / Atom feed
From: "Alex" <alex@foo.invalid>
Subject: Re: Need Help On Ada95 Problem
Date: Fri, 10 Feb 2012 15:32:27 +0000 (UTC)
Date: 2012-02-10T15:32:27+00:00	[thread overview]
Message-ID: <jh3dab$lo$1@dont-email.me> (raw)
In-Reply-To: wccobt67oct.fsf@shell01.TheWorld.com


Robert A Duff wrote:

> Writing the translation table is the
> homework assignment, and String makes no sense for that.
> But I might have misunderstood.

You may be right. The OP's post said the assignment was to

"Complete the function Encrypt(PIN) that takes a 4-digit PIN (as a
string) and returns the corresponding 4-letter code (also as a
string)"

so I assumed the translation table was also a string, given as part of
the provided code and local to the function. If it's not, and the
student is supposed to provide the mapping, then there are definitely
better options than using a string.

I'm curious about your code sample:

X : String(0 .. -1000);

I tried it and it works, but I don't understand how it's possible.
String is defined in ARM 3.6.3 as

type String is array(Positive range <>) of Character;

and your range is definitely outside of Positive. If I try 

X : String(0 .. 500); 

I get the expected compiler error. What's going on that allows the
range to be from 0 to a negative number?





  reply	other threads:[~2012-02-10 15:32 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-09  1:03 Need Help On Ada95 Problem Will
2012-02-09  1:51 ` Robert A Duff
2012-02-09  2:01 ` Shark8
2012-02-10  1:36   ` BrianG
2012-02-10  2:22     ` Shark8
2012-02-10  5:32       ` Alex
2012-02-10 15:19         ` Shark8
2012-02-10 15:45           ` Alex
2012-02-10 20:07           ` Robert A Duff
2012-02-12 19:40             ` Will
2012-02-12 19:42               ` Will
2012-02-12 22:26               ` Robert A Duff
2012-02-13  0:41                 ` Will
2012-02-13  0:43                 ` Nasser M. Abbasi
2012-02-10  5:45       ` Alex
2012-02-10 13:29         ` Robert A Duff
2012-02-10 13:50           ` Alex
2012-02-10 14:30             ` Robert A Duff
2012-02-10 15:32               ` Alex [this message]
2012-02-10 20:03                 ` Robert A Duff
2012-02-13  3:28       ` BrianG
2012-02-10  8:47   ` Simon Wright
2012-02-09  3:38 ` Alex
     [not found]   ` <90a10801-440b-4a31-88d0-f0f7c17137f1@eb6g2000vbb.googlegroups.com>
2012-02-09 13:35     ` Alex
replies disabled

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