[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scripting
Jorrit Tyberghein wrote:
>
>
> 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.
But you can use a part of the data structure which should have been
deleted. For example you may set the left branch of you tree node
to null, and think you got rid of it, and still access it through
a different object. (I guess I am comparing this to the use of
deleted memory, because it has been a long time since I
last made the "use of deleted memory" error, but somewhat
shorter time from a problem like this)
> - 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;
True
> - 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.
>
With rogue pointer I meant modifying a datastructure through
a reference which you didn't mean to use for modifying THAT
datastructure.
Well, I understand that whether you consider that these mistakes to
be comparable to ones which you can do in C++ is a matter of opinnion.
My personal experience is that both langues seem to have their
traps. The fact that I might prefer C++, where I like the concept of
constness and the possibility of (compile time) typesafe containers,
might be just because I have more experience with it.
BTW the scripting language I am using (LUA) also has
garbage collection and all the other typical safety goodies.
The reason I like it, is its ease of integration, and
its small size. With some support libraries compiled
in, it increases my program size less than 100k.
Eero
- Follow-Ups:
- Re: Scripting
- From: Jorrit Tyberghein <Jorrit.Tyberghein@uz.kuleuven.ac.be>