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,6009c73a58f787a0 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-01-11 06:49:25 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!news-out.visi.com!hermes.visi.com!uunet!ash.uu.net!world!news From: Robert A Duff Subject: Re: How to avoid unreferenced objects (mutexes etc) Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Fri, 11 Jan 2002 14:47:38 GMT References: <3c3ee8c8.105408250@News.CIS.DFN.DE> NNTP-Posting-Host: shell01.theworld.com Organization: The World Public Access UNIX, Brookline, MA X-Newsreader: Gnus v5.7/Emacs 20.7 Xref: archiver1.google.com comp.lang.ada:18777 Date: 2002-01-11T14:47:38+00:00 List-Id: dmitry@elros.cbb-automation.de (Dmitry A. Kazakov) writes: > Temp : Lock (Mutex_of_a_resource'Access); > The problem is that the object Temp is never referenced. The compiler > complains of that, but it is a minor problem. The questions are > > 1. Has the compiler right to optimize out Temp? No. There are some extra permissions to "optimize" away pseudo-dead variables of a non-limited type, even when init/fin have side effects. (there's an AI on that.) But your type is limited, and therefore immune to such meddling. > 2. Is there a better solution? Your solution is fine. - Bob