Re:Show HN: Chan – pure C implementation of Go channels
by eps on Saturday August 30, 2014 @01:57AM
(#8245808)
Using container_of is better because it doesn't lead to a broken code when someone (accidentally) splices another field at the top of the struct.
Or put differently, direct casting comes with an assumption, while container_of doesn't. The fewer obscure assumptions are there in the code, the better. I think we can all agree on that :)
Or put differently, direct casting comes with an assumption, while container_of doesn't. The fewer obscure assumptions are there in the code, the better. I think we can all agree on that :)