Julia,

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.

The following code is probably wrong:

char * ptr;

x=malloc(10*sizeof(ptr));

The intended argument to sizeof was probably *ptr
Being able to match a pointer argument to sizeof is
a useful thing to be able to do.

Another example is:

struct X x1, x2;
struct Y y;

memcpy(&x1, &x2, sizeof(struct Y));

where the argument to sizeof has a type that is probably wrong.

--
Derek M. Jones                         tel: +44 (0) 1252 520 667
Knowledge Software Ltd                 mailto:[email protected]
Source code analysis                   http://www.knosof.co.uk
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to