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=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!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 19 Jun 2004 15:54:14 -0500 Date: Sat, 19 Jun 2004 16:54:14 -0400 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Improving Ada's image - Was: 7E7 Flight Controls Electronics References: <40b9c99e$0$268$edfadb0f@dread16.news.tele.dk> <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> In-Reply-To: <1087488758.881520@master.nyc.kbcfp.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.147.90.114 X-Trace: sv3-L5QPL6hj7eZPbUoEMURZaS5IVQN/v23dS40+ya+OYF1/BymcNCJzN7ck6bm4uHX45JyYl6Za4Qr3Eiv!LnSgzQFJ8qDKXLTkt9VwqfDsCPCUzI0717exBfe5fcoVU9q02FPIVoIvW1FLsQ== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: g2news1.google.com comp.lang.ada:1701 Date: 2004-06-19T16:54:14-04:00 List-Id: Hyman Rosen wrote: > 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? Others have answered as well, but I carry it over into Ada as: type Colors is (Red, Green, Blue); type CMYK is (Cyan, Mageneta, Yellow, Black); Now if the "spelling" of the name is needed: X: CMYK; ... Put_Line(CMYK'Image(X)); I do think it is a shame though that Ada returns the upper case version of the name, not the spelling used to declare the type... This is in part why writing an Ada tutorial for C programmers is so hard. It is not that hard to write C code in Ada, and even get the compiler to produce identical executable code. The problem is that the _questions_ that the Ada progammer thinks about are very different from those that come up when programming in C. In this case you have been offered two ways to program a ragged array in Ada, one in which the pointer is explicit Red'Access, one in which it is implicit, Unbounded_String, and one where the ragged array is created by the compiler as part of the type declaration. -- Robert I. Eachus "Reason and experience both forbid us to expect that national morality can prevail in exclusion of religious principles." -- George Washington