RE: In-Out Parameters for functions

From: amado.alves (amado.alves_at_netcabo.pt)
Date: 01/23/04


Date: Fri, 23 Jan 2004 15:59:51 -0000
To: <comp.lang.ada@ada-france.org>


"I don't follow, and I would like to, because I find [IN] OUT params
for functions very useful. Could you please elaborate on that a bit
more?"
Maybe the most common example is the idiom (illegal in Ada):
  while Next (Item) loop
    Do_Something (Item);
  end loop;
where the Next function returns false in no more items are available,
and Item is an (illegal) in out parameter which holds the result of
a 'successful' call (and holds garbage on unsuccessful calls--this is
the ugly bit). The above idiom is perhaps the most clean solution for
the associated problem. I know I invariably use it when I write in C.
(Sorry for the possibly illformatted text.
I'm stuck with a crapy webmail system.)



Relevant Pages

  • Re: The switch "procedure"?
    ... loop must be placed into a procedure, ... part of this idiom is to not use inside the pipeline (kind ... of negates my definition of a pipeline). ... is working nobody will ever have to figure it out again. ...
    (comp.lang.tcl)
  • Re: A/B registers in Forth
    ... process (locals): 0,296699 sec ... process (params): 0,297403 sec ... CREATE area1 size CELLS ALLOT ... LOOP; ...
    (comp.lang.forth)
  • Re: string formatting with mapping & *... is this a bug?
    ... Pierre Fortin wrote: ... Ah, sorry, my favourite idiom to avoid the boilerplate of ... reference loop) so I should remember to 'del self.self' after it... ... you SHOULD hoist the "real format" out of the ...
    (comp.lang.python)
  • Re: < versus !=, was re: i++ vs. ++i
    ... 80's) he advocates always writing for loops in the form: ... He advocates a different idiom for C++ because he again wants a ... type of the loop control variable. ... Again there may be special reasons for doing it ...
    (alt.comp.lang.learn.c-cpp)
  • Re: getting values from URL such as http://groups.google.co.uk/groups?q=parameters+url+asp.net&s
    ... Using QueryString you can also loop through the params. ... Francisco Padron ...
    (microsoft.public.dotnet.framework.aspnet)