From 5681989451861378774
X-Google-Thread: f78e5,480a31feed3c6a1b
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news3.google.com!news2.google.com!newsread.com!news-xfer.newsread.com!news-feed01.roc.ny.frontiernet.net!nntp.frontiernet.net!newscon06.news.prodigy.com!prodigy.net!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.speakeasy.net!news.speakeasy.net.POSTED!not-for-mail
NNTP-Posting-Date: Wed, 08 Jun 2005 01:50:01 -0500
Return-Path: <devnull@stump.algebra.com>
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
Delivered-To: std-c++@ucar.edu
From: John Nagle <nagle@animats.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113
X-Accept-Language: en-us, en, ja
MIME-Version: 1.0
Newsgroups: comp.std.c++
Subject: Re: boost::shared_ptr revisited again
References: <4299DE64.40403@poczta.onet.pl><3g55jqFajuhcU1@news.dfncis.de>   <d7o5b6$3g3$1@nemesis.news.tpi.pl>   <ou0oe.1880$wy1.4@newssvr13.news.prodigy.com>   <S4Odne3eN6s1Cj3fRVn-2g@giganews.com>   <IHMn9C.1CM1@beaver.cs.washington.edu>   <AoWdnSlmv52dxDnfRVn-oA@giganews.com> <1118144437.192255.257840@g47g2000cwa.googlegroups.com> <k4ydnemTlqhbRjjfRVn-rw@rcn.net> <IHr3K9.1KJs@beaver.cs.washington.edu>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <H1wpe.1436$Z44.495@newssvr13.news.prodigy.com>
X-Complaints-To: abuse@prodigy.net
Organization: SBC http://yahoo.sbc.com
X-UserInfo1: TSU[@I_A\S@QBQLXCJKL^_TDEB\@PD\MNPWZKB]MPXHTEPIB_NVUAH_[BL[\IRKIANGGJBFNJF_DOLSCENSY^U@FRFUEXR@KFXYDBPWBCDQJA@X_DCBHXR[C@\EOKCJLED_SZ@RMWYXYWE_P@\\GOIW^@SYFFSWHFIXMADO@^[ADPRPETLBJ]RDGENSKQQZN
X-Virus-Scanned: amavisd-new at ucar.edu
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU
Date: Wed,  8 Jun 2005 01:48:42 CST
Lines: 47
NNTP-Posting-Host: 65.182.171.162
X-Trace: sv3-1V1RBUWGwbN1uhulX2UXifiijphHcH5OAqqt62IS033Jp080u0+8OihSMYXxoXzrqe5S1du3ccebtkS!cJNBY6REJa/y+lC/UgLTcn29z1+51sZP0+7PkAL66HF8eTZlarroce0sPCSc24IEAZZIECwKfFDJ!fer6HlLE9lVlL7eFI0WlmQW3Y4CCoLJu
X-Complaints-To: abuse@speakeasy.net
X-DMCA-Complaints-To: abuse@speakeasy.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.31
Xref: g2news1.google.com comp.std.c++:5027

Andrei Alexandrescu (See Website For Email) wrote:

> Pete Becker wrote:
> 
>> kanze@gabi-soft.fr wrote:
>>
>>> Pete Becker wrote:
> But Java did eliminate all dangling pointer bugs.
> 
> To clarify my response to the "runtime check": it is runtime, but if it 
> is done in hardware, it has zero time cost. My understanding of the 
> context of the discussion was that we were discussing that there is a 
> price to the "runtime check". The hardware trap mechanism costs only 
> silicon on the chip, and zero time.

     True.

     It's also worth noting that, with compiler support, many
run-time checks can be hoisted out of loops.  This is
particularly effective for subscript checks.  The technology
to do this was developed in the Pascal era, but has to
some extent been forgotten.  For one Pascal compiler,
it was observed that 95% of subscript checks could be
optimized out.

     Similarly, reference count updates can sometimes be
optimized out or hoisted out of loops.

     In both cases, though, the compiler needs to know what
to look for.  The compiler also has to be allowed to detect
errors "early".  That is, once an error becomes
inevitable, the implementation can report the error.
This allows hoisting subscript checks outside of loops.

     The notion that checking is inherently expensive comes
from poor implementations.  Berkeley Pascal for BSD comes
to mind; it made a subroutine call for every subscript check.

				John Nagle
				Animats

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



