[Mesa-dev] question about container_of

Julien Isorce julien.isorce at gmail.com
Mon Feb 27 12:08:34 UTC 2017


Hi,

Since 2012 commit ccff74971203b533bf16b46b49a9e61753f75e6c it is said:
"sample must be initialized, or else the result is undefined" in the
description of mesa/src/util/list.h::container_of .

But I can find a few places where it is used without initializing that
second parameter, i.e. like:

struct A a;
container_of(ptr, a, member);

Then I can add the "= NULL" but should it be just
container_of(ptr, struct A, member);
like in the kernel and some other places in mesa ?

Thx
Julien
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170227/7a6fc0dc/attachment.html>


More information about the mesa-dev mailing list