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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a046ce7f5ee1fa51 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-05 06:28:57 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: new_line in a put_line Date: 05 Dec 2002 09:19:18 -0500 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1039098638 17722 128.183.235.92 (5 Dec 2002 14:30:38 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 5 Dec 2002 14:30:38 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:31463 Date: 2002-12-05T14:30:38+00:00 List-Id: "Grein, Christoph" writes: > > > >> procedure Put_Line (Text : String) is > > > >> Get_It : Lock (Write_Mutex'Access); > > > >> begin > > > >> Ada.Text_IO.Put_Line (Text); > > > >> end Put_Line; > > > > > > > >Something inside me rebels at using side-effects from a declaration > > > >like that. > > > > > > Right, right. It is also my opinion [there was a thread regarding this > > > subject in c.l.a] that using unused (:-)) objects probably indicates a > > > design problem. > > > > That's what pragma Unreferenced (in GNAT) is for; it documents that > > the object is declared only for the hidden effects of Initialize and > > Finalize. > > > > Assuming Lock is a controlled type, that releases the lock in > > Finalize, this is an excellent design. > > This should only be necessary It's not "necessary" in any case. It does avoid a warning from GNAT, and it informs the reader. That's what I meant by "documents". > for objects of not limited controlled types. As I said, limited > controlled objects must not be optimized away. Yes, the reader could lookup the type of the variable and realized it is limited controlled. Unreferenced is quicker and clearer. -- -- Stephe