From -4046621554840956394
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,be4e234b6733532
X-Google-Attributes: gidf78e5,public
From: Tim Ottinger <tottinge@oma.com>
Subject: Re: why are pointers necessary?
Date: 1997/07/29
Message-ID: <33D80C4E.C7157E19@oma.com>#1/1
X-Deja-AN: 260223093
References: <captarm-2007971209450001@169.197.21.243> <rf5iuy2m9p1.fsf@vx.cit.alcatel.fr> <5r57bp$15j2$3@news.rchland.ibm.com>
X-Original-Date: Thu, 24 Jul 1997 21:15:43 -0500
X-Priority: 3 (Normal)
Organization: Object Mentor, Inc
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUBM94Y+ky4NqrwXLNJAQGS4QH/d5EL+kuiv8AWbwiLuorNaEpUUuF5VWKq gKhPKhqHlEf8zIFKRI1g/8SSuEsatub8mKqZkI3E/RHOTYJ1ETsMrg== =bX5q
Reply-To: tottinge@oma.com
Newsgroups: comp.std.c++
Originator: austern@isolde.mti.sgi.com


> |> Get a book about algorithms, and look up linked lists, trees,
> graphs,
> |> etc.
>
> All of which are possible without literal pointers.  Java gets by just
>
> fine without pointers.  Of course in most cases the construct you use
> instead of pointers (i.e., references) really are pointers "under
> the covers" but the compiler worries about the details instead of you.

Well, that's not really true. Everything in Java is a pointer. What java
gets by just fine without is pointer *arithmetic*.

But the real reason pointers are necessary is that they're the most
efficient built-in iterators for the built-in array types, they are used
as handles to dynamically allocated memory, and they're the only
nullable references we have. Oh, and because millions of C programs
depend on them.

Solve the first three (well) and you still have the fourth.
Compatibility is a two-edged sword. It really promotes the language, and
provides a migration path. But it also restricts the kinds of solutions
which may be applied.

Hey, it's not a perfect language. It is a useful language, though.

It also doesn't mean that there aren't some Java features which are more
attractive than the C++ equivalents. Java is a useful language, and
becoming moreso all the time. By saying good things about C++ I am
definitely not putting down java. I like both, so far (not doing work in
Java yet).

Tim
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu 
]



