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,bf511f1a798a00c5 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread1.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Unchecked deallocation issues References: <1134105321.360940.260560@o13g2000cwo.googlegroups.com> In-Reply-To: <1134105321.360940.260560@o13g2000cwo.googlegroups.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Fri, 09 Dec 2005 06:44:31 GMT NNTP-Posting-Host: 67.3.181.160 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.pas.earthlink.net 1134110671 67.3.181.160 (Thu, 08 Dec 2005 22:44:31 PST) NNTP-Posting-Date: Thu, 08 Dec 2005 22:44:31 PST Xref: g2news1.google.com comp.lang.ada:6790 Date: 2005-12-09T06:44:31+00:00 List-Id: ejijott@gmail.com wrote: > procedure case_delete( Parent : in out Storage; Node: in out > Storage; Direction:Integer ) is > > When I enter case_delete() parent is, obviously, the parent of the > matching node to delete and direction is wheter the matching node is on > the left or right of the parent. Integer has at least 2 ** 16 values, and probably 2 ** 32 values, and your structure has 2 directions. That seems like a lot of opportunities for errors. You should use something with 2 values for indicating directions. You could use On_Left : in Boolean On_Left indicates the matching node is on the left of Parent; not On_Left indicates that it's on the right. Perhaps better is to define your own type to indicate this: type Direction_ID is (Left, Right); Direction : in Direction_ID -- Jeff Carter "Why don't you bore a hole in yourself and let the sap run out?" Horse Feathers 49