comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: overriding in private part
Date: Sun, 05 Oct 2008 16:08:16 -0400
Date: 2008-10-05T16:08:16-04:00	[thread overview]
Message-ID: <wccfxna24b3.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: Pine.LNX.4.64.0810051338500.7900@medsec1.medien.uni-weimar.de

stefan-lucks@see-the.signature writes:

> On Sat, 4 Oct 2008, Robert A Duff wrote:
>
>> If you use a compiler that warns on missing "overriding", then you don't
>> need to say "not overriding", because that's the default -- any
>> subprogram that doesn't say "overriding" is not overriding.
>> Saying "not overriding" is just noise.
>
> "If you use a compiler that [does the right thing]" (or rather, if you use 
> that compiler and the right set compiler switches) that works more or less 
> fine. Except that you get only a warning on something that ought to be 
> treated as an error. (Yes, I know that gnat has a switch to treat warnings 
> as errors.)

Shrug.  To me, warnings and errors are pretty-much the same.
At AdaCore, we compile everything in warnings-as-errors mode.
Not always, but we have procedures in place that ensure no
Ada code can escape into customer's hands with warnings.

> But a compiler-agnostic way to enforce the proper behaviour (overriding 
> indicators for all the subprograms which actually override another 
> subprogram) would be preferable, IMHO. I wish there was an Ada 05
>   "pragma Overriding_Indicators_For_All_Oriding_Subprograms"
> or the like. Or did I overlook something like that in the standard?

I don't think you overlooked anything.  I agree portability is nice, so
it would nice to have a portable way to say this.  Pragma
Require_Overriding_Indicators might be a reaonable name.

But of course if you're worried about forgetting the warning switch, you
should be equally worried about forgetting that pragma.  Neither one
seems like a big problem -- it's something you do once, when setting up
your project-wide pragmas, or project-wide build scripts.  Much more
likely to forget "overriding" when declaring a procedure, which is
something you do every day.

Note that if you're writing code for several Ada compilers, you only
need one of them to give the warning.

- Bob



  reply	other threads:[~2008-10-05 20:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-02 15:49 overriding in private part Maxim Reznik
2008-10-02 16:42 ` Adam Beneschan
2008-10-03  8:52   ` Dmitry A. Kazakov
2008-10-03 15:54     ` Adam Beneschan
2008-10-03 20:29       ` Robert A Duff
2008-10-04  2:28         ` Randy Brukardt
2008-10-04 19:47           ` Robert A Duff
2008-10-05  7:35             ` Dmitry A. Kazakov
2008-10-05 19:57               ` Robert A Duff
2008-10-06  8:50                 ` Dmitry A. Kazakov
2008-10-06 23:32                   ` Randy Brukardt
2008-10-05 11:46             ` stefan-lucks
2008-10-05 20:08               ` Robert A Duff [this message]
2008-10-06 23:39                 ` Randy Brukardt
2008-10-02 23:17 ` Randy Brukardt
replies disabled

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