From: Simon Wright <simon@pushface.org>
Subject: Re: Array of records with default values not propagating to array
Date: Sat, 03 Feb 2018 15:26:54 +0000
Date: 2018-02-03T15:26:54+00:00 [thread overview]
Message-ID: <lybmh6nlfl.fsf@pushface.org> (raw)
In-Reply-To: 19b28472-5810-4306-b1b1-545cc7b6edcc@googlegroups.com
Jere <jhb.chat@gmail.com> writes:
> The big issue I see is not incrementing Index in the first loop. As
> it stands, you simply keep reassigning trumps to the same card over
> and over again.
When I copied OP's code it _did_ increment Index in the first loop. ??
I find that
type Card_Info (Trump : Boolean := False) is record
Name : Ada.Strings.Unbounded.Unbounded_String;
Divinatory_Meaning : Ada.Strings.Unbounded.Unbounded_String;
...
TDeck (Index) :=
(Trump => True,
Trump_Value => Index_1,
others => <>);
...
TDeck (Index) :=
(Trump => False,
Card_Value => Card_Index,
Suit_Value => Suit_Index,
others => <>);
compiles OK and seems to run perfectly well. Presumably this is OK
because the initial value for an otherwise-uninitialized unbounded
string is the empty string. Or maybe it's GNAT being over-helpful, since
it seems not to obey ARM 4.3.1(17.1)[1].
[1] http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-4-3-1.html#p17.1
next prev parent reply other threads:[~2018-02-03 15:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-03 11:06 Array of records with default values not propagating to array Bojan Bozovic
2018-02-03 14:16 ` Jere
2018-02-03 14:54 ` Bojan Bozovic
2018-02-03 15:26 ` Simon Wright [this message]
2018-02-03 16:07 ` Jere
2018-02-04 9:21 ` Niklas Holsti
2018-02-04 9:32 ` Simon Wright
2018-02-04 2:43 ` Robert Eachus
2018-02-04 4:59 ` Bojan Bozovic
2018-02-04 9:34 ` Simon Wright
2018-02-04 10:07 ` Niklas Holsti
2018-02-04 11:38 ` Bojan Bozovic
2018-02-04 10:19 ` Jeffrey R. Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox