From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!reader02.eternal-september.org!aioe.org!pBWEO6hi52oGFheO/GY5ag.user.gioia.aioe.org.POSTED!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: calling function but ignoring results Date: Wed, 30 Jun 2021 17:06:27 -0700 Organization: Aioe.org NNTP Server Message-ID: <867diayk1o.fsf@stephe-leake.org> References: <69a59fdc-72bb-4202-99fc-d776530de653n@googlegroups.com> NNTP-Posting-Host: pBWEO6hi52oGFheO/GY5ag.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt) X-Notice: Filtered by postfilter v. 0.9.2 Cancel-Lock: sha1:8b5qMyAnXr2qWloC9x7w5xg++Dk= Xref: reader02.eternal-september.org comp.lang.ada:62311 List-Id: Matt Borchers writes: > It is not very often that ignoring a function result is okay, but I > have run across many instances of the following block structure in > code over the years: > > declare > dont_care : BOOLEAN; > begin > dont_care := foo( x, y ); > end; With, GNAT, this can be: declare dont_care : BOOLEAN := foo( x, y ); pragma Unreferenced (dont_care); begin null; end; which makes the intent clear. I don't know if Unreferenced was proposed as a language addition; it's not in Ada 202x. -- -- Stephe