From: Maciej Sobczak <no.spam@no.spam.com>
Subject: Re: C Interface example
Date: Tue, 06 Feb 2007 09:20:52 +0100
Date: 2007-02-06T09:20:52+01:00 [thread overview]
Message-ID: <eq9dp5$c88$1@cernne03.cern.ch> (raw)
In-Reply-To: <db6dnU6LHvqGQ1rYnZ2dnUVZ_u6rnZ2d@megapath.net>
Randy Brukardt wrote:
> Anyway, the point is that if you just drop the result on the floor, the Ada
> compiler might be allowed to omit the call, too. So it is always best to use
> the result somehow. In this case, test it for null and do something
> explicit:
>
> if Result = null then
> raise Internal_Error;
> end if;
>
> where Internal_Error is an appropriately defined exception.
What about:
pragma Assert(Result /= null);
It's shorter, looks more "serious" and uses optimistic positive logic
instead of a negative one ("I'm alive!" instead of "Let's check whether
I'm dead").
The only problem is that there is no choice of exception.
--
Maciej Sobczak : http://www.msobczak.com/
Programming : http://www.msobczak.com/prog/
next prev parent reply other threads:[~2007-02-06 8:20 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-03 15:20 C Interface example artifact.one
2007-02-03 16:15 ` Ludovic Brenta
2007-02-03 17:15 ` Simon Wright
2007-02-03 19:43 ` Ludovic Brenta
2007-02-03 17:39 ` artifact.one
2007-02-04 14:34 ` Stephen Leake
2007-02-03 16:19 ` Cesar Rabak
2007-02-03 17:40 ` artifact.one
2007-02-03 19:59 ` Cesar Rabak
2007-02-03 17:48 ` Gautier
2007-02-03 18:09 ` artifact.one
2007-02-03 19:17 ` Georg Bauhaus
2007-02-03 19:53 ` artifact.one
2007-02-03 20:02 ` Gautier
2007-02-03 21:36 ` Georg Bauhaus
2007-02-03 19:48 ` tmoran
2007-02-03 19:55 ` artifact.one
2007-02-04 14:37 ` Stephen Leake
2007-02-03 20:42 ` Pascal Obry
2007-02-03 20:52 ` Jeffrey R. Carter
2007-02-03 20:57 ` artifact.one
2007-02-04 4:05 ` Jeffrey R. Carter
2007-02-04 11:52 ` Simon Wright
2007-02-04 20:59 ` Jeffrey R. Carter
2007-02-05 8:56 ` Maciej Sobczak
2007-02-05 18:12 ` Jeffrey R. Carter
2007-02-06 1:48 ` Randy Brukardt
2007-02-06 8:20 ` Maciej Sobczak [this message]
2007-02-06 19:18 ` Jeffrey R. Carter
2007-02-04 14:32 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox