compile time casts catching to void*

I

Igor.Starodubsky

Hi all,

The problem is to catch all explicit and implicit casts from given
type pointer to void pointer.

e.g
class FooClass {};

void* foo()
{
static FooClass* fooObject;
return fooObject;
}

ugly solution is:
I've used this command to make the substitution of void* for int* in
sources.
find . -execdir sed -i "s/void\s*\*/int\*/g" {} \;
Then I've made the compilation with -k option of make utility(Continue
as much as possible after an error) and grep for error "cannot convert
'FooClass*' to 'int*'". So I've caught "all" explicit/implicit casts
from FooClass pointer to void pointer at compile time.

Do you have better idea/solution for this problem?

os: linux
compiler: g++
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,900
Latest member
Nell636132

Latest Threads

Top