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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,308a261188818cce X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!g4g2000hsf.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Pointers explained? Date: Mon, 30 Jul 2007 14:23:34 -0700 Organization: http://groups.google.com Message-ID: <1185830614.681672.154960@g4g2000hsf.googlegroups.com> References: <1185817996.143086.317990@g12g2000prg.googlegroups.com> <1185818189.689914.159900@x40g2000prg.googlegroups.com> <1185824195.711745.136860@i13g2000prf.googlegroups.com> NNTP-Posting-Host: 85.3.71.241 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1185830615 14211 127.0.0.1 (30 Jul 2007 21:23:35 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 30 Jul 2007 21:23:35 +0000 (UTC) In-Reply-To: <1185824195.711745.136860@i13g2000prf.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.5) Gecko/20070713 Firefox/2.0.0.5,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: g4g2000hsf.googlegroups.com; posting-host=85.3.71.241; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Xref: g2news2.google.com comp.lang.ada:1278 Date: 2007-07-30T14:23:34-07:00 List-Id: On 30 Lip, 21:36, Adam Beneschan wrote: > C++ will of > course let you do that C++ will of course let you do that, but this statement itself is meaningless, because languages are never used directly. In real life you might want to use a *compiler* to compile the C++ code and recent versions of g++ produce a nice warning message when you try to return an address of a local variable (even without any additional options). I guess other C++ compilers are smart enough to do the same, so it's not that bad. On the other hand it is true that the whole scenario can be made more complex up to the point where the compiler will not catch the problem, but will have to accept it, so it's not perfect either. Note that Ada programmers also have 'Unrestricted_Access (GNAT) and 'Unchecked_Access to cheat around the rules. -- Maciej Sobczak http://www.msobczak.com/