home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
- From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
- Subject: Re: Give me safe C++
- Message-ID: <1992Dec12.145403.26483@ucc.su.OZ.AU>
- Sender: news@ucc.su.OZ.AU
- Nntp-Posting-Host: extro.ucc.su.oz.au
- Organization: MAXTAL P/L C/- University Computing Centre, Sydney
- References: <9234501.15945@mulga.cs.mu.OZ.AU> <Bz2nDF.7B6@fiu.edu> <WARSAW.92Dec11124441@anthem.nlm.nih.gov>
- Date: Sat, 12 Dec 1992 14:54:03 GMT
- Lines: 45
-
- In article <WARSAW.92Dec11124441@anthem.nlm.nih.gov> warsaw@nlm.nih.gov (Barry A. Warsaw) writes:
- >
- >>>>>> "Michael" == Michael Feathers <feathers@serss0> writes:
- >
- > Michael> The Ada people had the best of intentions, I'm sure, but
- > Michael> I think that C and C++ are versatile languages precisely
- > Michael> because no one ever tried to limit their functionality
- > Michael> with good intentions.
- >
- >Agreed. IMHO, the real power of C++ as a development language is the
- >ability to easily climb up and down the abstraction ladder depending
- >on the context of the problem. Sometimes you need to mingle with the
- >bits in the basement, sometimes you just need ADTs and sometimes you
- >really want to do OOP. The beauty of C++ is that it seamlessly
- >supports many levels of abstraction.
-
- While tending to support your liking of the C++ 'hybrid'
- approach, I'm not so sure about 'seamlessly', are you?
-
- And I think you tend to miss exactly where rigid restrictions
- on functionality are the things which *yield* the very power you desire.
- For example, virtual functions can be trivially implemented
- using function pointers. Function pointers in fact are a vastly
- more powerful technique than mere virtual functions.
-
- What makes virtual functions so useful is the fact that they
- are so tightly restricted .. for example, unlike a genuine
- function pointer they cannot be modified after object creation,
- nor specialised on a per object basis.
-
- So when language designers propose restrictions, one must
- carefully weigh up the pros and cons: most restrictions also
- grant freedom. In the case of virtual functions, if your
- program compiles and links they are sure to be properly initialised,
- freeing you from checking this manually. Inadvertant execution
- of uninitialised function pointers does result in interesting
- problems for those who enjoy debugging though.
-
-
-
- --
- ;----------------------------------------------------------------------
- JOHN (MAX) SKALLER, maxtal@extro.ucc.su.oz.au
- Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
- ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
-