Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!nic.MR.NET!umn-cs!bungia!orbit!pnet51!shawn From: shawn@pnet51.cts.com (Shawn Stanley) Newsgroups: comp.lang.c++ Subject: Re: using references vrs. pointers Message-ID: <583@orbit.UUCP> Date: 27 Jan 89 16:33:04 GMT Sender: root@orbit.UUCP Organization: People-Net [pnet51], Minneapolis, MN. Lines: 31 dog@vilya.UUCP (SCHIEBEL) writes: >A comment was made at the C++ conference in Denver last year that an >object oriented program should not use memory pointers. The rationale >being that we should be dealing with objects and not be distracted by >the implementation of the objects, including the fact that they exist >at some location in a computer's memory. Sounds reasonable to me. > >Thus, I would like to get away from memory pointers in my C++ programs and >make greater use of references. However, I seem to have no way of initializing >a reference to refer to nothing, or testing if it refers to nothing (akin >to a pointer to NULL). > >Maybe if I am going to create objects on the free store with new, I might as >well resign myself to dealing with pointers. I don't know. Any comments? I think the ability to use memory pointers is quite important. For instance, C itself allows you to get closer to the machine -- work on device drivers, things like that, without having to add the ability to the compiler itself. The user-driven library is a great advantage. In C++, you should be able to create device "objects" that can be re-used by anyone. Or, an object that has the ability to change the EGA graphics mode, by port-twiddling and such. Without direct access to memory, many device-oriented objects would have to be built into the language itself, which puts the entire burden on the compiler author. I think it is more important that developers have the ability to write their own device-oriented objects (and related objects), and thus there becomes a wealth of objects from third-parties to control whatever you have a mind to plug into your machine... UUCP: {rosevax, crash}!orbit!pnet51!shawn INET: shawn@pnet51.cts.com