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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news2.google.com!news.glorb.com!newsgate.cistron.nl!xs4all!peer.news.zetnet.net!peer-uk.news.demon.net!kibo.news.demon.net!mutlu.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: memory management in Ada: tedious without GC? Date: Sun, 18 May 2008 09:06:55 +0100 Organization: Pushface Message-ID: References: <4ddef8bf-b5b1-4d7e-b75b-386cd6c8402c@l17g2000pri.googlegroups.com> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1211098015 7961 62.49.19.209 (18 May 2008 08:06:55 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Sun, 18 May 2008 08:06:55 +0000 (UTC) Cancel-Lock: sha1:4U7zk8yX1JBToa9swoLOsYrROoE= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (darwin) Xref: g2news1.google.com comp.lang.ada:194 Date: 2008-05-18T09:06:55+01:00 List-Id: Brian Drummond writes: > Which explained to me how changing from ptr to auto_ptr (presumably > to make code safer!) can introduce a spectacularly silly bug, > completely statically determinable, but which the compiler allows > just fine and lets the code die with a segfault. Is auto_ptr the one where assignment moves the content? "b = a;" means that a is now null and b references the previous content of a? If so, it seems to me that it's the concept that's spectacularly silly! (I considered introducing an auto pointer into the Booch Components, but then thought about using it .. I can see that there might be a use within a very narrow scope, but a standard ref-counted smart pointer works just as well. No doubt there is an appropriate usage idiom?)