4 ms·
The way that this is overcome is that most garbage collectors only permit direct pointers to an object rather than to a particular field inside an object. For e
by koenigdavidmj 12y ago
The way that this is overcome is that most garbage collectors only permit direct pointers to an object rather than to a particular field inside an object. For example, there's no Java equivalent to this C:
void a(int *b)
{
*b = 5;
}
struct c
{
int d;
};
int main()
{
struct c foo;
a(&foo.d); // no way to do this in Java!
printf("%lu\n", (unsigned long)foo.d);
}