comp.lang.ada
 help / color / mirror / Atom feed
From: "Smark" <not.provided@all.com>
Subject: Default expression only allowed for "in" parameters - why?
Date: Fri, 6 Apr 2001 15:41:52 -0500
Date: 2001-04-06T15:41:52-05:00	[thread overview]
Message-ID: <9al9mc$jgk2@cui1.lmms.lmco.com> (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





             reply	other threads:[~2001-04-06 20:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-06 20:41 Smark [this message]
2001-04-06 21:30 ` Default expression only allowed for "in" parameters - why? 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
replies disabled

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