From 7577056308139275798
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,ccbfcafab96cf493
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2001-12-04 11:58:01 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!dispose.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: Pete Becker <petebecker@acm.org>
Newsgroups: comp.std.c++
Subject: Re: Proposol to increase robustness of programs
Date: Tue,  4 Dec 2001 19:57:06 GMT
Organization: Dinkumware, Ltd
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <3C0D2876.D1652E64@acm.org>
References: <3BFE97B3.91430FB1@wanadoo.fr> <T23N7.64$%j1.23498@news11-gui.server.ntli.net> <3C058126.36357A00@acm.org> <7dc3b1ea.0111300954.186f1ff5@posting.google.com> <3C094998.F387ABB1@acm.org> <9uh371$778$1@eeyore.INS.cwru.edu>
X-Trace: mail2news.demon.co.uk 1007495833 mail2news:24329 mail2news mail2news.demon.co.uk
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
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)
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Date: 4 Dec 2001 19:47:37 GMT
X-Accept-Language:  en
Lines: 66
Xref: archiver1.google.com comp.std.c++:8469

Ken Alverson wrote:
> 
> "Pete Becker" <petebecker@acm.org> wrote in message
> news:3C094998.F387ABB1@acm.org...
> > Peter Dimov wrote:
> > >
> > > Pete Becker <petebecker@acm.org> wrote in message
> news:<3C058126.36357A00@acm.org>...
> > >
> > > [override keyword]
> > >
> > > > The reason that it doesn't get any support from me is that it solves a
> > > > non-problem. If you want to be sure that your member function
> overrides
> > > > a virtual function in the base, write a test case that calls it
> through
> > > > the base. You have to do this anyway, in order to check the behavior
> of
> > > > your derived class. So this error falls out automatically from routine
> > > > testing.
> > >
> > > You are right. Programmers that use unit tests (group #1) don't need
> > > override.
> > >
> > > On the other hand, programmers that do not do proper testing (group
> > > #2) will benefit from it. The cost will be an extra keyword.
> > >
> > > Not giving group #2 what they want will not automatically make them
> > > migrate to #1.
> > >
> >
> > Giving group #2 what they want won't turn them into good programmers.
> 
> Everyone makes mistakes and forgets to check things, even the unit test
> writing group #1 people.

Any test that reasonably exercises a derived class will detect that a
base doesn't declare an expected function to be virtual. This isn't
something you design for, and isn't something you can forget to check.
It just happens. Unless, of course, you don't write tests, in which case
'override' isn't going to save you.

> Saying that a feature that would reinforce their
> tests and catch mistakes they might miss is bad

I haven't said it was bad. I said it's unnecessary.

> simply because it shouldn't
> be necessary is like saying that airbags are bad because people should be
> wearing their seatbelts.  Sometimes the seatbelt fails, and it's nice to
> know you have redundant means of protection...even if you do wear your
> seatbelt.
> 

Redundant only matters if the other protection can fail.

-- 
Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)

---
[ 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.research.att.com/~austern/csc/faq.html                ]



