From: dvdeug@x8b4e53cd.dhcp.okstate.edu (David Starner)
Subject: Re: Exiting from a function or procedure
Date: 2000/04/22
Date: 2000-04-22T00:00:00+00:00 [thread overview]
Message-ID: <8dsu7h$8i41@news.cis.okstate.edu> (raw)
In-Reply-To: m3k8hqorqr.fsf@ns55.infomatch.bc.ca
On 22 Apr 2000 12:33:32 -0700, Ray Blaak <blaak@infomatch.com> wrote:
>tmoran@bix.com writes:
>> > So NEVER EVER ignore warnings, consider them as errors. In
>> > fact you might want to use -gnatwe so the compiler will
>> > treat them as errors enforcing this discipline.
>>
>> This is not always a good idea. For instance
>> if OK then
>> return some_value;
>> else
>> Log_And_Raise_Error;
>> end if;
>> end some_function;
>> is a perfectly legitimate paradigm in Ada that would become
>> illegal in Gnat with -gnatwe, since the compiler doesn't know
>> that Log_And_Raise_Error will never return.
>
>I always put in a dummy return in these cases, just to avoid such warnings, and
>for safety if the log routine ever *doesn't* raise an exception (e.g. maybe due
>to some maintenance change in the future).
Of course, that masks a bug. Log_And_Raise_Error is defined to raise an
exception - if it doesn't then it's buggy. Either that, or the maintenance
programmer should have fixed every use of Log_And_Raise_Error - and a dummy
return is unlikely to be the correct fix. At least in developement, raising
Program_Error is a good result.
--
David Starner - dstarner98@aasaa.ofe.org
Finger dvdeug@x8b4e53cd.dhcp.okstate.edu for more information.
Only a nerd would worry about wrong parentheses with
square brackets. But that's what mathematicians are.
-- Dr. Burchard, math professor at OSU
next prev parent reply other threads:[~2000-04-22 0:00 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-04-21 0:00 Exiting from a function or procedure Andres Tarallo
2000-04-21 0:00 ` Robert A Duff
2000-04-21 0:00 ` tmoran
2000-04-21 0:00 ` Andres Tarallo
2000-04-22 0:00 ` Robert Dewar
2000-04-22 0:00 ` Pablo Moisset
2000-04-23 0:00 ` Robert Dewar
2000-04-22 0:00 ` Ken Garlington
2000-04-22 0:00 ` tmoran
2000-04-22 0:00 ` Ray Blaak
2000-04-22 0:00 ` David Starner [this message]
2000-04-23 0:00 ` Robert Dewar
2000-04-23 0:00 ` tmoran
2000-04-24 0:00 ` Robert Dewar
2000-04-24 0:00 ` Robert Dewar
2000-04-24 0:00 ` tmoran
2000-04-24 0:00 ` Robert Dewar
2000-04-24 0:00 ` Scott Ingram
2000-04-22 0:00 ` Robert Dewar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox