comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: Re: gnatcheck
Date: Tue, 23 Dec 2008 08:30:35 -0800 (PST)
Date: 2008-12-23T08:30:35-08:00	[thread overview]
Message-ID: <5897d4c8-eeb0-40cb-808b-09d8cf4d2a1a@s9g2000prg.googlegroups.com> (raw)
In-Reply-To: gir392$nub$1@online.de

On Dec 23, 5:22 pm, Stefan Soos <stefan.s...@gmx.de> wrote:
> John B. Matthews wrote:
> > In article <gioss0$q9...@online.de>, Stefan Soos <stefan.s...@gmx.de>
> > 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:
>
> > <http://gcc.gnu.org/onlinedocs/gcc-4.3.2/gnat_ugn_unw/>
>
> 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.



  reply	other threads:[~2008-12-23 16:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-22 20:21 gnatcheck Stefan Soos
2008-12-23  4:19 ` gnatcheck John B. Matthews
2008-12-23 16:22   ` gnatcheck Stefan Soos
2008-12-23 16:30     ` Ludovic Brenta [this message]
2008-12-23 16:53       ` gnatcheck Stefan Soos
2008-12-23 17:06         ` gnatcheck Ed Falis
2008-12-24 20:03     ` gnatcheck Stephen Leake
2008-12-23 19:49 ` gnatcheck Robert A Duff
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox