On Wed, Nov 10, 2010 at 16:28 +0100, Julia Lawall wrote:
> It also occurred to me that in eg sizeof(*x), where x has type int *, the 
> reference to *x is not really a reference to an integer value, and the 
> reference to x is not really a reference to an integer pointer value.  
> Thus there is no longer any type inference for the argument to sizeof.  If 
> this seems like a bad decision, please let me know and I will change it 
> back.

Why?..  I don't see any troubles with it.  The only uniqueness of
sizeof() is that it doesn't really calculates its argument, e.g. 
after "int a = 1; sizeof(a++);" a is still 1, but AFAIU this should not
influence on coccinelle.

But it is impossible to differ wrong type passing to memset:

struct X *ll;
memset(ll, 0, sizeof(*ll));

vs.

struct X *ll; /* l + l */
struct Y *l1; /* l + 1 (number one) */
memset(ll, 0, sizeof(*l1));


Also, is there any way to explicitly specify sizeof(int/long/void*) by
command line argument?

> Also, if there are any other type problems please let me know.

Sure :)


Thanks,

-- 
Vasiliy
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to