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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!Xl.tags.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Mon, 24 Nov 2014 11:42:20 -0600 From: Dennis Lee Bieber Newsgroups: comp.lang.ada Subject: Re: How to get nice with GNAT? Date: Mon, 24 Nov 2014 12:42:29 -0500 Organization: IISS Elusive Unicorn Message-ID: References: <0d8452a9-68c9-4835-b6f3-17407132ca9f@googlegroups.com> X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 108.79.223.64 X-Trace: sv3-zJXMNJN4A9EU6W93pJVh/ue3N2pvTn+Q9gjb5Sf60b23CfS6rFfwksMG0Sh8eo78Es805Lb0WWdmm65!XbhlojXsBvIs2T+Ce4KX5tte1xqkF6G29vW3Ac0BVIo46eQ16VgoAqXOrHT+0SP42PyR+m9dwhcr!qtWr/5J4XW/G8llbRGGksX2y9CU= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 3313 Xref: news.eternal-september.org comp.lang.ada:23697 Date: 2014-11-24T12:42:29-05:00 List-Id: On Sun, 23 Nov 2014 19:05:18 -0800 (PST), brbarkstrom@gmail.com declaimed the following: > >The GNAT GPL GPS tool on my Ubuntu 14.04 LTS system returns the >two warnings: >7.10 warning: assignment to pass-by-copy formal may have no effect >7.10 warning: "raise" statement may result in abnormal return > (RM 6.4.1(17)) > >In other words, a programmer shouldn't expect a variable input to >an "out" variable in the interface specification to have any relation >to whatever is generated in the procedure that is called. Secondly, >an exception raised in the procedure test may result in an abnormal >return. This is hardly a clean piece of code. > >When I run it, the output from the code does something that seems >to me to be an abnormal return. It returns the output "TRUE". >The output claims that "the process terminated successfully, ...". >It certainly isn't the expected behavior in a reasonable reading of the >procedure text. Rather it suggests that the compiler completely ignored >whatever went on in the procedure. > I would interpret it to mean that the raise statement aborted the function "test" before the copying of the "FALSE" value into the return structure on the stack, so the main procedure never sees the value change. If scalar's are handled as locals that are copied from the passed parameters on input and then copied back upon (normal) exit -- this makes sense. The last paragraph of the (2005) Reference Manual, section 6.4.1 Parameter Associations reads: After normal completion and leaving of a subprogram, for each IN OUT or OUT parameter that is passed by copy, the value of the formal parameter is converted to the subtype of the variable given as the actual parameter and assigned to it. Note that: "after normal completion and leaving ... and assigned to it". The raise is not "normal completion", and thereby may not perform the "assign". -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/