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-Thread: 103376,13bec1d6e8f0eeee X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!s9g2000prg.googlegroups.com!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: gnatcheck Date: Tue, 23 Dec 2008 08:30:35 -0800 (PST) Organization: http://groups.google.com Message-ID: <5897d4c8-eeb0-40cb-808b-09d8cf4d2a1a@s9g2000prg.googlegroups.com> References: NNTP-Posting-Host: 88.170.86.208 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1230049836 29507 127.0.0.1 (23 Dec 2008 16:30:36 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 23 Dec 2008 16:30:36 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: s9g2000prg.googlegroups.com; posting-host=88.170.86.208; posting-account=pcLQNgkAAAD9TrXkhkIgiY6-MDtJjIlC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.18) Gecko/20081030 Iceape/1.1.13 (Debian-1.1.13-1),gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:3078 Date: 2008-12-23T08:30:35-08:00 List-Id: On Dec 23, 5:22 pm, Stefan Soos wrote: > John B. Matthews wrote: > > In article , Stefan Soos > > wrote: > > > [...] > >> when I use gnatcheck on my project, I get a bunch of error messages > >> for coding standard violations. Where can I find more infos what the > >> different rules mean? For example, I get "declaration of > >> discriminanted record". Now I'd like to know why this is a violation > >> and where in the RM I can read more about it. Can I make gnatcheck to > >> be more verbose or specific? > > > I'd start with the GNAT User's Guide section on gnatcheck: > > > > > Hi, > Thanks but I've already checked this source, but it's no help to me. It describes what gnatcheck does when using the Discriminated_Record rule. But I don't know why its a violation. Whats wrong with discriminated records? > Another example. Predefined_Numeric_Types. I know I shouldn't used them. But I know it because a long time ago I read it in the ARM. Theres no reference in gnatcheck to the specific chapter in the ARM. > I'd like to improve my code and evolve a good programming habit, but it's really hard to google all the rules with no results. > > I hope someone can enlighten me. I wish you all a merry christmas, > Stefan I think this is because discriminated records can be variant records, i.e. some components exist for some values of the discriminant but not for others. Dealing with such types requires extra care from the programmer and increases the possibility of Constraint_Error at run time. Also, they can make the program more difficult to read for people new to Ada. The ARM does not give any advice on "good style"; it only says what is legal and what is not. Discriminated records are legal and are useful in a number of situations. -- Ludovic Brenta.