From: "Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not>
Subject: Re: Empty String confusion; Positive and Natural
Date: Tue, 30 Nov 2021 11:00:11 +0100 [thread overview]
Message-ID: <so4snd$s9c$1@dont-email.me> (raw)
In-Reply-To: <bea93bf3-f282-4e9b-8806-2b956d58fe51n@googlegroups.com>
On 2021-11-29 23:50, Kevin Chadwick wrote:
>
> Hopefully I will have a doh moment when I get into the office in the morning and post code. I am getting a range check exception when I assign "" to a standard.String in a record by returning the record from a function. Surely, I must have caused it somehow.
It sounds as if you think type String is magic. String is a
one-dimensional array type, no different than any other one-dimensional
array type. It is declared in ARM A.1(37/3)
(http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-A-1.html) as
type String is array(Positive range <>) of Character
with Pack;
If you think that
type T is array (Positive range <>) of Integer;
V : T (1 .. 5);
...
V := (1 .. 0 => <>);
should work, then you don't understand arrays in Ada.
If you understand why that won't work, then
S : String (1 .. 5);
...
S := "";
is the exact same thing and fails in the same way for the same reason.
--
Jeff Carter
"I did not rob a bank. If I'd robbed a bank, everything
would be great. I tried to rob a bank, is what happened,
and they got me. I misspelled the note."
Take the Money and Run
140
next prev parent reply other threads:[~2021-11-30 10:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-29 17:34 Empty String confusion; Positive and Natural Kevin Chadwick
2021-11-29 18:05 ` Jeffrey R.Carter
2021-11-29 19:19 ` Niklas Holsti
2021-11-29 22:50 ` Kevin Chadwick
2021-11-30 8:29 ` Simon Wright
2021-11-30 8:34 ` Niklas Holsti
2021-11-30 10:00 ` Jeffrey R.Carter [this message]
2021-11-30 12:17 ` Kevin Chadwick
2021-11-30 12:54 ` J-P. Rosen
2021-11-30 13:12 ` Kevin Chadwick
2021-11-30 7:40 ` ldries46
2021-11-30 8:21 ` Simon Wright
2021-11-30 12:39 ` ldries46
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox