From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=BAYES_00,INVALID_MSGID, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,803df5f3f60558d5 X-Google-Attributes: gid103376,public From: pascal.obry@der.edfgdf.fr (Pascal Obry) Subject: Re: Uninitialized "out" parameters Date: 1996/07/19 Message-ID: <4sne1p$9vj@cf01>#1/1 X-Deja-AN: 169635965 references: <31EEACDA.64880EEB@sage.inel.gov> <4smh9i$gp5@krusty.irvine.com> organization: EDF - DER newsgroups: comp.lang.ada Date: 1996-07-19T00:00:00+00:00 List-Id: adam@irvine.com (Adam Beneschan) wrote: >Paul Whittington writes: > >In the following Ada program, should either the compiler or the run-time > >get some kind of error because the out parameter is not initialized? > > > >procedure Testit is > > > > procedure SubP (op : out Integer) is > > begin > > op := op+1; > > end SubP; > > > > I : Integer; > > > >begin > > SubP (I); > >end Testit; >Well, you can't read an "out" parameter at all, so it's illegal to use >"op" in the right-hand side of your assignment. So the compiler >should give you an error. Also, in Ada83, you'll get an error because >I needs to be declared before the code for SubP appears. This is wrong for Ada(95). In Ada you can read out parameter, and this program is then not valid. It's behavior is unknown. >If you change op to an "in out" parameter, you'll be reading an >uninitialized variable, but typically neither the compiler nor the >runtime will complain. > -- Adam Pascal. --|------------------------------------------------------------ --| Pascal Obry Team-Ada Member | --| | --| EDF-DER-IPN-SID- Ing�nierie des Syst�mes d'Informations | --| | --| Bureau G1-010 e-mail: pascal.obry@der.edfgdf.fr | --| 1 Av G�n�ral de Gaulle voice : +33-1-47.65.50.91 | --| 92141 Clamart CEDEX fax : +33-1-47.65.50.07 | --| FRANCE | --|------------------------------------------------------------ --| --| http://ourworld.compuserve.com/homepages/pascal_obry --| --| "The best way to travel is by means of imagination"