Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeder2.ecngs.de!ecngs!feeder.ecngs.de!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 06 Apr 2013 03:12:00 -0500 Date: Sat, 06 Apr 2013 09:11:58 +0100 From: lipska the kat <"nospam at neversurrender dot co dot uk"> Organization: Trollbusters 3 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 Newsgroups: comp.lang.java.programmer Subject: Re: arrays and variables References: <19un43xj77bua.vw45l4e2wshi.dlg@40tude.net> <1uednTu2Z5ByUcPMnZ2dnUVZ8i-dnZ2d@bt.com> <78a7719f-3519-48a5-b36d-d8b7ddcafe7c@googlegroups.com> In-Reply-To: <78a7719f-3519-48a5-b36d-d8b7ddcafe7c@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: Lines: 64 X-Usenet-Provider: http://www.giganews.com X-AuthenticatedUsername: NoAuthUser X-Trace: sv3-aiLeNLDoM4h+8BRdvY/Vu0KhfI0tBG2eRQGV6qf8m9npRX2YgkD0HE8d0XeYKXZ8EdkQmBh+CoA+rZz!HZezqpnyeQjz6NFQc7rSiVqqksmLtRCzQkcdvceS+rWfToSCKAHkmEFM/c4GVBTcVw5Tt1fjc84= X-Complaints-To: abuse@btinternet.com X-DMCA-Complaints-To: abuse@btinternet.com X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 3679 Xref: csiph.com comp.lang.java.programmer:23344 On 05/04/13 21:33, Lew wrote: > lipska the kat wrote: >> Stefan Ram wrote: >>> Arved Sandstrom writes: >>>> Stefan Ram wrote: >>>>> Arved Sandstrom writes: >> >> [snip] >> >>> What is C? We have pointers in Java, see the JLS. >> >> Do we? I never knew that > > It's in the JLS, 4.3.1. > "An object is a class instance or an array. > > "The reference values (often just references) are pointers to these objects, > and a special null reference, which refers to no object." This is a rhetorical usage of the word pointer and says nothing about the underlying mechanism used to implement references. >> a pointer in C >> >> int x >> int *iptr; >> iptr = &x; >> iptr++; //stupid but not illegal >> >> How would I do that in Java using pointers (note the *pointer arithmatic*). > > Java does not have pointer arithmetic. You don't say :-| > It only has pointers for reference types Weasel words, I don't believe that you actually believe that. A reference is an abstraction of a pointer, this is an absolutely fundamental concept and any newbie lurkers take note *a reference is not a pointer*, it's a reference. *IF* a reference is implemented as a pointer under the covers then that is an implementation detail. It is hypothetically possible to implement Java as a Turing Machine, in this case a reference would not be a 'pointer' but a square on an infinite tape that might contain an instruction that instructs the machine how to interpret the next square on the tape. Is this square a pointer? What does a reference abstract? it abstracts the mechanism by which Java provides access to instances of classes, it abstracts the mechanism by which Java allocates space to store that instance and it provides the mechanism to populate the allocated space. Besides, a pointer without pointer arithmetic isn't a pointer (IMHO of course) :-) [snip] lipska -- Lipska the KatŠ: Troll hunter, sandbox destroyer and farscape dreamer of Aeryn Sun