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-Thread: 103376,a31b00ad713d92f9 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 11 Apr 2007 12:18:51 -0500 From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Impossible problem? A protected buffer to queue objects of a class-wide type References: <461cc46d$1_1@glkas0286.greenlnk.net> X-Newsreader: Tom's custom newsreader Message-ID: <-7-dneQWpqjmhYDbnZ2dnUVZ_gadnZ2d@comcast.com> Date: Wed, 11 Apr 2007 12:18:51 -0500 NNTP-Posting-Host: 24.6.140.189 X-Trace: sv3-HUb252rth/+L66Pw5NVf9VX5MnoQcvo/7krc6ozbv3fu80XR4tpPR+Y807VHKEBQlCZCZSlCkL++xRX!3plkDqkaXhvgo9OCezZhzs/AkNXFkErnnx/92PzUNq35mBN+5/Efa/lx2aZborFgY3ZLiv5pXseB!FNEx5WRcqlPQmwg5fACLdM9CbuVg X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.34 Xref: g2news1.google.com comp.lang.ada:14913 Date: 2007-04-11T12:18:51-05:00 List-Id: > - I did consider writing a protected buffer with an entry whose out > parameter was an access-to-class-wide type, but this is highly > unsatisfactory as it puts the onus for deallocating heap space into the > client code - very messy. 1. You need to use an entry with an out parameter that's an access type. 2. You don't want the user to have to deal with access types and deallocation. Therefore you have to put some code between the user and the entry call. 3. You want the user to call a function that returns a class-wide type. Therefore that in-between code should be a function that calls the entry, copies the object from the heap to a temporary, deallocates the heap space, and does a "return" of the temporary. For consistency, you probably want to hide the protected object in a private type so the user never calls it directly, but all user calls are to regular procedures or functions.