Christian Christmann said:
Hi,
I was asked to remove the void*'s from an old project.
My idea was to replace them with templates.
Is this a good idea? How would you proceed?
There is no pat answer we can give you.
The questions, in each individual case, will be "What is this variable being
used for?", "What type of data does it *really* represent?" and "Is there a
reason that this is declared as void* in the first place?"
It could be that many of those have legitimate uses. Or not. You'll have
to deal with each variable on its own.
Simply being told to "remove all void*s" is rather silly, in my opinion. If
it is felt that the current software is poorly written, then the software in
its entirety needs to be reviewed, documented, and potentially redesigned,
prior to simply making coding changes.
Of course, we do what we're told, most of the time. But honestly, there's
nothing we can tell you about what to use instead of void*, because we have
no idea what each of those cases are.
If you have questions about a specific case or two that stump you, post
those here and we might be able to suggest a better alternative. Otherwise,
it'll be up to you to decide each individual case.
Sorry, but it looks like you've got your work cut out for you.
-Howard