[PATCH] [StaticAnalyzer] New checker Sizeof on expression

Matt Calabrese rivorus at gmail.com
Tue Nov 26 17:46:35 PST 2013

On Wed, Oct 23, 2013 at 4:58 PM, Richard Smith <richard at metafoo.co.uk>wrote:

> Sure. I think it's even fine for a compiler warning, since sizeof(size_t)
> is a clearer way to get the same result.

I know I'm a little late here, but I think the reason why you wouldn't want
to use sizeof(size_t) is that you need to include certain standard library
headers to pull in size_t, I.E. <cstddef>. The same goes for ptrdiff_t.
Doing sizeof(sizeof(whatever)) frees you from that requirement.

-Matt Calabrese
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131126/7a97adfe/attachment.html>

More information about the cfe-commits mailing list