From 2996718692137072657 X-Google-Thread: f78e5,3c316a202087bfac X-Google-Attributes: gidf78e5,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!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, 19 Apr 2006 14:20:05 -0500 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on ak74.algebra.com X-Spam-Level: **** X-Spam-Status: No, score=4.9 required=5.0 tests=FORGED_YAHOO_RCVD,HEADER_SPAM, MISSING_HEADERS,NO_REAL_NAME,TO_CC_NONE autolearn=disabled version=3.1.1 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) X-Original-To: std-c++@mailman.ucar.edu Delivered-To: std-c++@mailman.ucar.edu Delivered-To: std-c++@ucar.edu From: johnchx2@yahoo.com Newsgroups: comp.std.c++ Subject: Re: Defining undefined, etc., behavior Organization: http://groups.google.com Message-ID: <1145474138.478756.14120@j33g2000cwa.googlegroups.com> References: <123m587c3abqge4@corp.supernews.com> <4442b95c$0$12939$91cee783@newsreader02.highway.telekom.at> <1145386296.297098.316050@j33g2000cwa.googlegroups.com> <44463c6f$0$3883$91cee783@newsreader01.highway.telekom.at> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Complaints-To: groups-abuse@google.com User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.2) Gecko/20060308 Firefox/1.5.0.2,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: j33g2000cwa.googlegroups.com; posting-host=207.202.132.38; posting-account=1HxwpAwAAABlK5OZfZYCg5RQRtKiYFfE X-Virus-Scanned: amavisd-new at ucar.edu X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU Approved: Fergus Henderson , moderator of comp.std.c++ X-Virus-Scanned: amavisd-new at cs.mu.OZ.AU Date: Wed, 19 Apr 2006 14:17:08 CST Lines: 51 NNTP-Posting-Host: 65.182.171.162 X-Trace: sv3-SEwFqsKZQss5NLBmbN/yPWU6deMrUCC62xDlJBkCXMdAAzk/oSmqTRiOBAgkbaPNfJ60mh1BUmZJgCp!/A9TiJiPntPTWVkKt5WQ8+jAPeoXqzJ7i8NTPqNsbuKZtCDcsLe+KkutdoAOovNSzMSEFf9E/fHq!N3LRsskCPuRzxdHG4EOJulfLxYqRi831x7tGMgt2WQ== 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.32 Xref: g2news1.google.com comp.std.c++:1617 Nicolas Pavlidis wrote: > In this case you know, that the list isn't empty, but there are also > cases where you can not be so sure, if you use some external librray for > example. Of course. And only you, the caller, know which situation you're in. > And IMHO it''s not that preformance leak, if I say: > > if(size != 0) {// dosomehting} > > or is this code soo slow? Not at all, if the check is needed in this context. Perhaps I misunderstood your post...when you wrote: >> If the list is empyt everythign can happen, again the question, why >> not pakking the code into the method. Why should the user must >> care about the inetrnal state of the list, ind this example. I thought that you were asking why the std::list::front() method isn't required to check for the empty-list condition for you. My point was that the library implemention, in general, can't tell whether the check is necessary or redundant. > > Or I can use templates, to specifiy if I want a check or not, thats the > next posibility. > > Or I do the check only in the debug build. > > There a lot posibilities to solve this problem, IMHO. > Yes, I agree. But none of them require a change to the standard's definition of std::list itself. (There actually is a precedent for adding a formally redundant error-checked operation in a standard library container: std::vector::at(). But I don't get the impression that there's a lot of support for adding more of the same.) --- [ 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.comeaucomputing.com/csc/faq.html ]