Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What is the difference between what you are calling virtual pointer tables and what the kernel does in a lot of places?

http://lxr.free-electrons.com/source/fs/ext4/symlink.c#L93



Its the extent to which it is done.

virtual pointer tables are an age-old 'C' mechanism of providing runtime configuration for drivers and such like.

the WTF project, took that idea and had virtual pointers for everything methods, data, superclasses, etc.

Every line consisted of something like the following:

obj->vptr->methodA(obj, objB->vptr->methodB());

it very rapidly becomes a readability and maintainability nightmare.


Sorry, I'm still not following your argument.


dereferencing the vptr in the Linux device tables tends to happen once per (say) function.

the WTF project would have '->vptr' and worse '->super->vptr->method(), maybe 20 or 30 times per function.

every call in the codebase or data reference would be via a '->vptr'.

That really makes a difference.... its unreadable. literally.


So based on one project's misuse of a technique (OO in C) you dismissed it as "bad" idea, "stay away from this", it's "attempting to be clever", and the rest?

I think that's why I'm not following you. You've dismissed OO in C in its entirety, and advised others to do the same, based on your experience in one project which misused/overused the feature.


no.

The level to which it is used in Linux is effectively idiomatic.

The project I'm referring to used the technique properly. Its just a bad technique.


You've said it is a bad technique no matter how it is used, and you have said it is an ok technique if used at some levels (like the Kernel) but not others (like the WTF project).

So you can see how I'm confused about what your opinion really is, I hope.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: