[cfe-dev] sizeof (RopeRefCountString)

Ted Kremenek kremenek at apple.com
Mon Sep 15 21:46:24 PDT 2008


On Sep 15, 2008, at 9:41 PM, Daniel Dunbar wrote:

> #include <stddef.h>
>
> unsigned AllocSize = sizeof(RopeRefCountString) -
> offsetof(RopeRefCountString,Data) + AllocChunkSize;

I don't think that's right.  sizeof(RopeRefCountString) -  
offsetof(RopeRefCountString,Data) is 4.  What we want is the number of  
bytes before "data", not after (inclusive).

Probably:

   offsetof(RopeRefCountString,Data) + AllocChunkSize





More information about the cfe-dev mailing list