From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.222.25 with SMTP id v25mr31354332iog.103.1517712230446; Sat, 03 Feb 2018 18:43:50 -0800 (PST) X-Received: by 10.157.32.68 with SMTP id n62mr2431365ota.6.1517712230372; Sat, 03 Feb 2018 18:43:50 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.am4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!w142no1193463ita.0!news-out.google.com!k194ni4502itb.0!nntp.google.com!g80no1198208itg.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 3 Feb 2018 18:43:49 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2601:191:8303:2100:7466:f44c:da21:40b1; posting-account=fdRd8woAAADTIlxCu9FgvDrUK4wPzvy3 NNTP-Posting-Host: 2601:191:8303:2100:7466:f44c:da21:40b1 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Array of records with default values not propagating to array From: Robert Eachus Injection-Date: Sun, 04 Feb 2018 02:43:50 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Body-CRC: 3348808754 X-Received-Bytes: 2999 Xref: reader02.eternal-september.org comp.lang.ada:50294 Date: 2018-02-03T18:43:49-08:00 List-Id: On Saturday, February 3, 2018 at 6:06:52 AM UTC-5, Bojan Bozovic wrote: > When I defined a record, and set a default value for some of its componen= ts, these don't propagate when I make array of these records. > Thanks for help. I could explain the rules that result in the need for the others part, but = that won't help you move forward. What I suggest is you first try commenti= ng out the call to Shuffle, and see if you can print out your initial deck. If so, replace the others with explicit initial values for the two Unbounde= d_Strings. (Or just temporarily comment out those fields in the declaration= and the others.) If that fixes it, fine. Send a bug report to Ada_Core and go on with your = life and code. Note that if I were writing this code, I would shuffle a vector, then indir= ect through the vector to get the card values: =20 type Deck is array (Card_Position) of access Card_Info; then Initialize assigns values to each. (Need to change the two TDeck assi= gnments to create new access values.) Now Shuffle swapping pointers instead= of several variable length fields. I think the only change necessary to S= huffle to do this is the declaration of Temporary_Data. Is this worth doing now? Only if there really is an GNAT bug and getting r= id of the others doesn't fix it. This is certainly an optimization worth c= onsidering after the program is running. Oh one last detail which you may be leaving until later. When using tarot = decks it is usually important to know if the card is inverted or not. Agai= n something to add once the rest of it is working.