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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8623fab5750cd6aa X-Google-Attributes: gid103376,public Path: g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!nnx.oleane.net!oleane!freenix!wanadoo.fr!not-for-mail From: Pascal Obry Newsgroups: comp.lang.ada Subject: Re: Improving Ada's image - Was: 7E7 Flight Controls Electronics Date: 17 Jun 2004 23:05:30 +0200 Organization: Home - http://perso.wanadoo.fr/pascal.obry Message-ID: References: <40b9c99e$0$268$edfadb0f@dread16.news.tele.dk> <7J0xc.7371$8k4.269106@news20.bellglobal.com> <1086630278.542788@master.nyc.kbcfp.com> <8xlxc.27603$sS2.845496@news20.bellglobal.com> <1086715817.122983@master.nyc.kbcfp.com> <1086733411.736049@master.nyc.kbcfp.com> <3Auxc.11998$XY6.1296622@read2.cgocable.net> <40C85035.4020706@noplace.com> <40C9EC3B.60304@noplace.com> <40CD90A4.8030005@noplace.com> <40CEDCB5.9000509@noplace.com> <1087325485.307616@master.nyc.kbcfp.com> <1087488758.881520@master.nyc.kbcfp.com> NNTP-Posting-Host: avelizy-103-1-4-212.w80-11.abo.wanadoo.fr Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news-reader2.wanadoo.fr 1087506336 23688 80.11.102.212 (17 Jun 2004 21:05:36 GMT) X-Complaints-To: abuse@wanadoo.fr NNTP-Posting-Date: 17 Jun 2004 21:05:36 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.95 Xref: g2news1.google.com comp.lang.ada:1631 Date: 2004-06-17T21:05:36+00:00 List-Id: Hyman Rosen writes: > Just for example, it is ubiquitous in C to have arrays of > strings, either with or without a null pointer terminator: > const char *colors[] = { "Red", "Green", "Blue", 0 }; > const char *CMYK[] = { "Cyan", "Magenta", "Yellow", "Black" }; > How do you carry this over into Ada? As you've done in C, using pointers (I mean access types :): type String_Access is access constant String; type Color_Set is array (Positive range <>) of String_Access; Red : aliased constant String := "Red"; Green : aliased constant String := "Green"; Blue : aliased constant String := "Blue"; Colors : constant Color_Set := (Red'Access, Green'Access, Blue'Access); No need for a "null" terminator. In Ada we have the array bounds: for K in Colors'Range loop ... end loop; Pascal. -- --|------------------------------------------------------ --| Pascal Obry Team-Ada Member --| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE --|------------------------------------------------------ --| http://www.obry.org --| "The best way to travel is by means of imagination" --| --| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595