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=unavailable autolearn_force=no version=3.4.4 Path: buffer2.nntp.dca1.giganews.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!newspeer1.nac.net!newsfeed1.swip.net!81.169.171.211.MISMATCH!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: What do you think about this? Date: Wed, 24 Jun 2015 10:20:23 -0700 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: <9894cde7-2cf8-4060-be65-857812ad7b09@googlegroups.com> <17436268-aceb-461f-bdcf-eee8436cd0e6@googlegroups.com> <86y4jaqzdx.fsf@stephe-leake.org> <86oak5qulb.fsf@stephe-leake.org> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Wed, 24 Jun 2015 17:19:05 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="a3855fbfe1a666be9aefba0563039ed5"; logging-data="25903"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Tj/6Jq7YN+hyApSe1zMNBUemmg6huQfM=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: <86oak5qulb.fsf@stephe-leake.org> Cancel-Lock: sha1:YCV8N9MKFvCP/vPSUellNLtzMQc= Xref: number.nntp.giganews.com comp.lang.ada:193763 Date: 2015-06-24T10:20:23-07:00 List-Id: On 06/24/2015 03:17 AM, Stephen Leake wrote: > Laurent writes: > >> CMI_Type is ("<=1","0,004","3"); or CMI_Type is ("1","2","3"); > > This is not an enumeration; it is an aggregate of strings. In Ada you > can do this as: Actually, it's invalid. > type CMI_Type is array (Integer range <>) of access constant String; > > CMI_1 : constant CMI_Type := (+"<=", +"0,004", +"3"); This is a terrible idea. As compiler writer, ARG member, and ARM editor Brukardt said recently in another thread, anonymous access types are evil. I would even argue against a named access type for this, since unbounded strings are available. In this case, the OP has an instance of bounded strings available and would probably want to use that. >> but that works CMI_Type is ('1','2','3'); ? > > This defines a new character type. > > An enumeration type would be: > > type CMI_Type is (One, Two, Three); A character type is an enumeration type. Type Character is an enumeration type, though one a normal user can't duplicate. I only looked at the main-program procedure, but my comments are * Inconsistent use of blank lines * Inconsistent indentation There's a function named Make_File_Name. A good guideline is to give procedures names that are verb phrases (such as Make_File_Name); boolean functions, predicates (Empty or Is_Empty); and other functions, noun phrases (File_Name). File_Name would be a better name for this function. The function returns a bounded string, but the only place it's used takes String, and so involves a conversion of the result. The function itself creates its result as a String, then converts it to a bounded string before returning it. This may be confusing to the reader; I looked around a bit for other uses, trying to figure out why it was returning a bounded string rather than String. For this reason (not efficiency), I'd recommend that the function return String. -- Jeff Carter "Well, a gala day is enough for me. I don't think I can handle any more." Duck Soup 93