Re: Pointer vs Reference



Joshua Cranmer <Pidgeot18@xxxxxxxxxxx> writes:

In Java, it really is a pointer. The JLS actually specifically says
that reference values are pointers, as Stefan pointed out.

Probably refering to
"The reference values (often just /references/) are /pointers/ to these
objects, and a special null reference, which refers to no object."
- JLS 4.3.1

However, the JLS doesn't say what a "pointer" *is*, so that doesn't make
us any wiser. It has to be taken as merely informal explanation.

The word "pointer" is used in a few places around the JLS:

6.8.7:
"... Abbreviations, as in buf holding a pointer to a buffer of
some kind ..."

15.13.2
"because the embedded assignment of 2 to index occurs before the check
for a null pointer."

and ofcourse in the index:
"pointers
See references"
and
"pointer, 42" - referencing the first quote.

I.e., the JLS identifies references and "pointers", so saying that
references are pointers is trivial and vacuous.

/L
--
Lasse Reichstein Nielsen - lrn@xxxxxxxxxx
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
.



Relevant Pages

  • Re: =& when creating new object
    ... $reference point to the same memory location. ... Please read the chapter called "references are not pointers" in the ... should not consider it an address in PHP. ...
    (comp.lang.php)
  • Re: Delphi Classes/Pointers] Nil references causing problems.
    ... In the context of this group I often write "Pascal" instead of Delphi or OPL, ... references - something like C++ references, ... Almost every language allows to express things in a specific manner, ... occupation I'm tired of seeing pointers all around, and the many tests for NULL ...
    (comp.lang.pascal.delphi.misc)
  • Re: =& when creating new object
    ... & means 'a reference to the memory location where the value is stored'. ... That was probably the single most unique new concept (pointers and address-of) I had conquer when I learned C, coming from a Fortran background as I did. ... Please read the chapter called "references are not pointers" in the manual. ... But you should not consider it an address in PHP. ...
    (comp.lang.php)
  • Re: PHP5 and class inheritance question
    ... describe references in relationship to something which doesn't exist. ... knowledge of pointers as defined by another language. ... You're the one who tried to compare PHP references to something which ... get a clue jerry. ...
    (comp.lang.php)
  • Re: Deleting objects obtained from a STL library
    ... >> I want to use an STL libarary to hold a bunch of objects I create. ... >> besides using pointers rather than references for the STL library? ... The container uses the copy constructor, if no copy c_tor is provided ...
    (comp.lang.cpp)