comp.lang.ada
 help / color / mirror / Atom feed
From: "DuckE" <nospam_steved94@home.com>
Subject: Re: When to do a constraint check and not ??
Date: Fri, 26 Oct 2001 13:57:42 GMT
Date: 2001-10-26T13:57:42+00:00	[thread overview]
Message-ID: <qZdC7.2120$sR2.277946@news1.sttln1.wa.home.com> (raw)
In-Reply-To: 3BD91EF8.EEB7EDBA@systems.saab.se

I'm not sure about the "rules" but...
I used a tool to translate a bunch of Pascal code to Ada.  The tool turned
"var" parameters into "in out" parameters.  Your example illustrates the
problem with that mapping.

We went through the translated code and depending on which made more sense:
  either initialized the variable prior to the call:
  b : boolean := FALSE;
  or changed the mode of the procedure parameter to "out":
  procedure test( p : out boolean ) is

Without these changes both GNAT and ObjectAda raise exceptions.

SteveD

"Per Sandberg" <prsa@systems.saab.se> wrote in message
news:3BD91EF8.EEB7EDBA@systems.saab.se...
> Assume the folowing code:
>
> procedue bla is
> b : boolean; --< B may contain any bit pattern at this point.
>
> procedure test( p : in out boolean ) is
> begin
> b := false;
> end test;
>
> begin
> test(b); --<< Is the compiler allowed to insert a constraint check on b
> here ??
> end;
>
> Is the answer that it is up to the wendor.
> I did not get any clues from the LRM.
>
> /Per Sandberg.





  parent reply	other threads:[~2001-10-26 13:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-26  8:29 When to do a constraint check and not ?? Per Sandberg
2001-10-26 12:01 ` Peter Hend�n
2001-10-26 13:57 ` DuckE [this message]
2001-10-26 14:18 ` Ted Dennison
2001-10-26 23:44 ` Jeffrey Carter
2001-11-01 17:54 ` Tucker Taft
2001-11-02  3:44   ` Robert Dewar
2001-11-05 10:02 ` Peter Amey
replies disabled

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