comp.lang.ada
 help / color / mirror / Atom feed
From: "Christoph Karl Walter Grein" <AdaMagica@web.de>
To: comp.lang.ada@ada-france.org
Subject: Re: "out" and  "in out"
Date: Mon, 26 Jul 2004 12:54:04 +0200
Date: 2004-07-26T12:54:04+02:00	[thread overview]
Message-ID: <mailman.44.1090839265.416.comp.lang.ada@ada-france.org> (raw)

"no reliable initial value" means, you cannot rely on the value, but it may have a value. This depends on the parameter passing mechanism, which is _not_ related to the parameter mode (contrary to what many people think).

So the parameter mode is there (nearly) solely for the information of the reader. The parameter passing mechanism for all kinds of parameters is defined in the RM. There are parameters passed by copy (in and out), by reference; for some it is explicitly left undefined.

In your case, the passing mechanism is by reference, so you get what you get. But don't rely on this, rely only on the mode, i.e. the parameter st is undefined upon entering the procedure modify, so when you only write component 2, upon return, only component 2 has been written. Under slight variations, the result of your code might be <garbage character>U<garbage character>.

Another thing: Don't rely upon s1'First = 1. Component 2 might not exist. You could call modify like so:

X: String (25..30);
modify (X);

Now s1(2) inevitably will raise Constraint_Error.
____________________________________________________
Aufnehmen, abschicken, nah sein - So einfach ist 
WEB.DE Video-Mail: http://freemail.web.de/?mc=021200




             reply	other threads:[~2004-07-26 10:54 UTC|newest]

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

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