[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scripting
Eero Pajarre wrote:
>
> I have always thought that the way data structures are done in Java
> very much resembles typical pointer usage. Garbage collection
> of course relieves me from manually freeing data, and indexing errors
> are also checked (but I can get the latter also in C++, and I could
> even use gc there). Still it is quite possible to make mistakes
> with java which correspond to stale and rogue pointers in C++.
Well not really. For example, errors you can do in C++ but not in Java:
- Accidently use memory that has already been deleted but the
pointer was not cleared.
- Assign something out of bounds to some memory area: in Java
pointer arithmetic is simply not possible. You cannot do things like
*(a+100) = 10;
- State and rogue pointers are simply NOT possible in Java.
There is no way you can have a pointer to something that doesn't
exist anymore.
Greetings,
--
==============================================================================
Jorrit.Tyberghein@uz.kuleuven.ac.be, University Hospitals KU Leuven BELGIUM
The labyrinth of Ephebe is ancient and full of one hundred and one amazing
things you can do with hidden springs, razor-sharp knives, and falling
rocks.
-- (Terry Pratchett, Small Gods)
==============================================================================