comp.lang.ada
 help / color / mirror / Atom feed
From: Vinzent Hoefler <JeLlyFish.software@gmx.net>
Subject: Re: Ada style of passing 'in' parameters considered dangerous?
Date: Sat, 08 Feb 2003 21:33:18 -0500
Date: 2003-02-08T21:33:18-05:00	[thread overview]
Message-ID: <b24env$18emm2$1@ID-175126.news.dfncis.de> (raw)
In-Reply-To: wcc3cmyw6t5.fsf@shell01.TheWorld.com

Robert A Duff <bobduff@shell01.TheWorld.com> wrote:

>Antti Sykari <jsykari@gamma.hut.fi> writes:
>
>> - Have you encountered a non-trivial real-life case where the
>>   programmer has shot himself in the foot in the form of
>>   implementation-defined behavior because of the error mentioned above?
>>   I'd be interested to hear of any such cases.

I once did encounter such problem. It wasn't Ada, it was Pascal, so it
had nothing to do with "implementation defined", but if you take a
closer look to it, the problem might be considered as similar.

I changed the parameter mode of a string to "const" because there was
no write access to it. So then it was passed by reference instead of
by value like it did before. The bad thing was, this string was part
of another parameter to this procedure so indeed the string got
changed during the call. An example of badly structured data, I'd say.

>I don't know.  I would feel more comfortable if one could *prove* that
>such things can't happen.

Well, that's what SPARK is for.

>One possible solution is to disallow cases that might be aliased.

Like SPARK does. :)


Vinzent.



  reply	other threads:[~2003-02-09  2:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-08 22:24 Ada style of passing 'in' parameters considered dangerous? Antti Sykari
2003-02-09  0:41 ` James S. Rogers
2003-02-09  2:11   ` Robert A Duff
2003-02-09  2:25   ` Jeffrey Carter
2003-02-11  8:39   ` Gautier
2003-02-09  2:01 ` Robert A Duff
2003-02-09  2:33   ` Vinzent Hoefler [this message]
2003-02-09  6:07   ` Richard Riehle
2003-02-09  7:13   ` Robert I. Eachus
2003-02-10  4:40     ` Martin Dowie
2003-02-09  2:08 ` Jeffrey Carter
2003-02-10  0:13 ` Leif Holmgren
2003-02-10  9:49 ` Rod Chapman
2003-02-11  9:14 ` Gautier
2003-02-11 13:49   ` Antti Sykari
2003-02-11 17:18   ` Gautier
2003-02-11 17:29     ` Vinzent Hoefler
2003-02-12  1:09   ` Richard Riehle
replies disabled

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