From: Stephen Leake <Stephen.A.Leake@nasa.gov>
Subject: Re: new_line in a put_line
Date: 05 Dec 2002 09:19:18 -0500
Date: 2002-12-05T14:30:38+00:00 [thread overview]
Message-ID: <uy974a6qh.fsf@nasa.gov> (raw)
In-Reply-To: mailman.1039070162.7388.comp.lang.ada@ada.eu.org
"Grein, Christoph" <christoph.grein@eurocopter.com> 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
next prev parent reply other threads:[~2002-12-05 14:19 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-05 6:28 new_line in a put_line Grein, Christoph
2002-12-05 14:19 ` Stephen Leake [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-12-05 6:16 Grein, Christoph
2002-12-05 9:44 ` Dmitry A. Kazakov
2002-12-04 10:03 Grein, Christoph
2002-12-03 11:52 Grein, Christoph
2002-12-04 9:39 ` Fraser Wilson
2002-12-02 5:36 Vlad
2002-12-02 9:47 ` Preben Randhol
2002-12-02 17:04 ` Frank J. Lhota
2002-12-05 11:10 ` Preben Randhol
2002-12-02 10:14 ` Dmitry A. Kazakov
2002-12-02 14:57 ` Matthew Heaney
2002-12-03 11:33 ` Fraser Wilson
2002-12-03 15:01 ` Dmitry A. Kazakov
2002-12-04 9:31 ` Fraser Wilson
2002-12-04 14:10 ` Dmitry A. Kazakov
2002-12-04 15:23 ` Robert A Duff
2002-12-04 16:15 ` Dmitry A. Kazakov
2002-12-04 18:11 ` tmoran
2002-12-04 20:21 ` Simon Wright
2002-12-05 9:36 ` Dmitry A. Kazakov
2002-12-05 22:40 ` tmoran
2002-12-04 15:25 ` Stephen Leake
2002-12-04 16:55 ` Jeffrey Carter
2002-12-04 17:24 ` Stephen Leake
2002-12-04 17:43 ` Warren W. Gay VE3WWG
2002-12-05 1:31 ` Jeffrey Carter
2002-12-05 18:11 ` Warren W. Gay VE3WWG
2002-12-02 15:49 ` Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox