Possible problems with _RBTree_Container_of
gedare at rtems.org
Wed Nov 9 14:17:40 UTC 2011
On Wed, Nov 9, 2011 at 4:13 AM, Ralf Corsepius <ralf.corsepius at rtems.org> wrote:
> On 11/08/2011 11:59 PM, Gedare Bloom wrote:
>> Hi Sebastien,
>> I originally wrote this code, but I casted the node to a size_t. It
>> looks like the macro was changed recently without a PR
> Correct, your code was multiliply broken, It likely only worked by random
> accident on some targets.
Yes it depended on the size of size_t being the same as an address,
which is not right. But removing the cast introduces the new problem
that the type is completely ignored.
>> so I must have
>> missed it in the VC logs and will take a look.
> It was me.
>> The possible problem isn't really solved by casting to void*,
> Agreed - I don't see what add a cast to void* would fix.
Casting to uintptr_t might be a good idea; the compiler should get
angry if something that isn't a pointer is given.
More information about the users