[cfe-commits] [patch] Warn on memset(p, 0, sizeof(p))

Anders Carlsson andersca at mac.com
Mon Jun 13 08:15:44 PDT 2011

On Jun 12, 2011, at 10:23 PM, Nico Weber wrote:

> Hi,
> the attached patch produces this diagnostic
>  test.cpp:16:17: warning: The sizeof expression in 'memset' has type
> 'S *', the same type that the first argument has. The sizeof
> expression should probably have type 'S' instead.

This diagnostic doesn't sound quite right. It's not the sizeof expression that has type 'S *' (the sizeof expression always has type size_t).

- Anders

More information about the cfe-commits mailing list