[cfe-dev] sizeof(struct::member)

Cory Nelson phrosty at gmail.com
Mon Sep 20 22:22:05 PDT 2010


On Mon, Sep 20, 2010 at 5:58 PM, Nico Weber <thakis at chromium.org> wrote:
> Hi clang folks,
>
> I have this code:
>
>  sockaddr_un sizecheck;  // not used for anything except sizeof.
>  const size_t kMaxPipeNameLength = sizeof(sizecheck.sun_path);
>
> Clang warns about |sizecheck| not being used. Do you consider that a bug?
>
> If so, is there some way to write "sizeof(struct::member)" that
> doesn't warn in clang?

I don't know if Clang supports it yet, but in C++0x it is okay to do
sizeof(struct::member).

-- 
Cory Nelson
http://int64.org




More information about the cfe-dev mailing list