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.224.115.18 with SMTP id g18mr2282595qaq.3.1392653376931; Mon, 17 Feb 2014 08:09:36 -0800 (PST) X-Received: by 10.140.49.65 with SMTP id p59mr818qga.41.1392653376895; Mon, 17 Feb 2014 08:09:36 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!k15no22187378qaq.0!news-out.google.com!dr7ni182qab.1!nntp.google.com!f11no22215975qae.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 17 Feb 2014 08:09:36 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=188.115.2.128; posting-account=sDyr7QoAAAA7hiaifqt-gaKY2K7OZ8RQ NNTP-Posting-Host: 188.115.2.128 References: <4a3e55f6-9f54-4084-9f37-96efd4b0d349@googlegroups.com> <0b358700-871b-4603-addd-65e07c7d59e5@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <48278bd6-740c-40aa-b098-e20fe84fe911@googlegroups.com> Subject: Re: Something I don't understand From: Laurent Injection-Date: Mon, 17 Feb 2014 16:09:36 +0000 Content-Type: text/plain; charset=ISO-8859-1 X-Received-Bytes: 3045 X-Received-Body-CRC: 2213559403 Xref: news.eternal-september.org comp.lang.ada:18635 Date: 2014-02-17T08:09:36-08:00 List-Id: Am Sonntag, 16. Februar 2014 02:39:34 UTC+1 schrieb Robert A Duff: > Some stylistic comments on the code below: > Exceptions are for dealing with cases where one piece of code detects > a (possible) error, and another piece of code decides whether it > case here, so should be written without any exceptions. As I wrote in my first post the whole thing is an exercise from a book. I'm learning programming mostly by myself and it is just an hobby. The actual chapter is about ADTs and most of them which are part of the exercise I'm doing were written by the author of this book. So I think it was/is best to stick to the way the author named his variables or build his programs. > No need for a loop name. Not needed yes, but they won't hurt anyone. In this package is not only this loop but a few others. So I put named loops instead of comments. > You should use typical style, so other Ada programmers can read your > code more easily: lower case keywords, Max_Name instead of MaxName. > (Or Max_Name_Length?) Dito first answer > S should declared "constant". You should enable warnings in GNAT > that detect this mistake. MaxName : CONSTANT Positive := 30; -- defined in other package SUBTYPE NameType IS String (1 .. MaxName); -- defined in other package It is, unfortunately with the original version of the code GNAT didn't complain about Name >MaxName. > Why should there be a limit on the length of the name? Maybe you have > a good reason, but usually such arbitrary limits are a bad idea. Book Author's choice Thanks for the advice but in this case I think I will stick to the formatting given in the book.Still have the possibility to adapt it later. Laurent