Parameter typechecking

Sampath Peechu speechu@hotmail.com
Fri Nov 22 18:33:00 GMT 2002


Hi,

I would like to know if there is a way for the compiler to detect a 
parameter type (defined using typedef) mismatch. For example in the 
following piece of code,

typedef int myint;
typedef int myshort;

int myfunc(myint i);

main()
{
	myshort s = 10;
	myfunc(s);
}

is it possible to enable the compiler to flag an warning or error when an 
argument of type 'myshort' is passed instead of 'myint' ? If not, is there a 
workaround to catch such problems ?

I have looked at the various options of gcc but couldn't find one that fits 
in.

thanks in advance,
Sampath Peechu

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* 
http://join.msn.com/?page=features/virus



More information about the Gcc mailing list