comp.lang.ada
 help / color / mirror / Atom feed
* Default expression only allowed for "in" parameters - why?
@ 2001-04-06 20:41 Smark
  2001-04-06 21:30 ` Corey Ashford
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Smark @ 2001-04-06 20:41 UTC (permalink / raw)


LRM 6.1(19):
    A default_expression is only allowed in a parameter_specification
    for a formal parameter of mode in.

I recently had a situation in which it was desirable for me to have
a default value for an "out" parameter of a function.  It was something
like:

procedure Do_Something (Data   : in Some_Type;
                        Status : out Status_Type);

Normally, Status = Ok.  It seemed to me that, rather than setting
Status := Ok at the beginning of my procedure, it would make sense to
just set the default value in the procedure spec.  That is:

procedure Do_Something (Data   : in Some_Type;
                        Status : out Status_Type := Ok);

It also seemed like a strange idea, because I never recalled seeing
it done.  Sure enough, it is prohibited by the LRM.  What is the
rationale for this?

TIA,
Mark





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2001-04-10 13:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-06 20:41 Default expression only allowed for "in" parameters - why? Smark
2001-04-06 21:30 ` Corey Ashford
2001-04-06 21:49 ` Robert A Duff
2001-04-07  4:19   ` Ben Brosgol
2001-04-09 14:42     ` Marin David Condic
2001-04-09 15:08   ` Smark
2001-04-10 13:59     ` Martin Dowie
2001-04-07 14:12 ` Charles H. Sampson
2001-04-07 18:17   ` Ben Brosgol
2001-04-09 14:07 ` Marin David Condic

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