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!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Pass a serial port as user data in a GTK callback handler? Date: Thu, 20 Feb 2014 11:07:47 +0000 Organization: A noiseless patient Spider Message-ID: References: <050a1b45-c312-4fff-96f9-7c3d01466500@googlegroups.com> <58fb9abc-1892-4a36-9895-c494dbc727c9@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="accbe75cb89a13856bb11e3e154f69e9"; logging-data="31943"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18CP0erZqTYYANKFX55qhZyd7tYvfxmTyk=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:MrTLbkT42nnJbyvccrg59RPbhUQ= sha1:x6RWgI4h0stgGJj3L3PfmnKRSic= Xref: news.eternal-september.org comp.lang.ada:18699 Date: 2014-02-20T11:07:47+00:00 List-Id: "Randy Brukardt" writes: > Note that pool-specific access types are a bit safer in general, > because you can (with effort, admittedly not usually done) make > deallocation safe. Whereas with general access, even if you have a > valid (non-dangling) access object, you can't figure out whether it is > safe (and necessary) to deallocate it or if you should just drop it on > the floor. And if you get that wrong, you have storage leaks or > erroneous execution. > > At least in Ada 2012 you can create a convinient smart pointer > abstraction that takes care of all of that. Probably we ought to have > considered adding such a thing to the standard library. Most of the component libraries that started life with Ada 95 include smart pointers. I must admit that my effort wasn't convenient or very safe (access values were visible, and the user was expected not to deallocate them).