comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: "out" and  "in out"
Date: Mon, 26 Jul 2004 13:30:11 +0200
Date: 2004-07-26T13:30:11+02:00	[thread overview]
Message-ID: <1150612.FPCVxyNjoV@linux1.krischik.com> (raw)
In-Reply-To: 4104d5de@dnews.tpgi.com.au

zork wrote:

> now I get as a result "CUT", and i dont understand why i get this result.
> Doesnt the "out" specify that its initial value isnt passed in via the
> parameter? But it seems to be passed in the above. In fact the "out" is
> acting like an "in out". I am a little confused. Could someone shed some
> light on this?

No it means: Does not *need* to be passed in. However, if using a pointer
instead of the value gives better performance the compiler will do that.
Also there are types which for technical reasons need to be passed using a
pointer.

What you have done comes under "undefined beahavior". If you used:

type s_type is new string (1 .. 3);

s : s_type = "CAT";

procedure modify ( s1 : out s_type) is
begin
ᅵᅵᅵs1(2)ᅵ:=ᅵ'U';
end modify; 

things *might* be different on standart CPU's since s_type is smaller then
32 bit. BTW: String is indefinite and size therefore undefined. 

With Regards

Martin

-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com




  parent reply	other threads:[~2004-07-26 11:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-26  9:58 "out" and "in out" zork
2004-07-26 11:00 ` David C. Hoos
2004-07-26 11:30 ` Martin Krischik [this message]
2004-07-26 14:46 ` Nick Roberts
2004-07-28 14:07   ` zork
  -- strict thread matches above, loose matches on Subject: below --
2004-07-26 10:54 Christoph Karl Walter Grein
2004-07-26 14:16 ` Marc A. Criley
replies disabled

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