> I still think we should revert the cast and see how C++ code complains 

Is anyone suggesting the cast should be kept?

In my view it would be a kind of madness to keep the cast - C is weakly typed 
as it is, so removing the little type checking we can get from the compiler is 
foolhardy and will just create subtle timewasting bugs.  C++ has better typing, 
generics and true OO, so I don't see why the cast should be present there, or 
that container_of should be particularly useful when better type-safety can be 
achieved.

> and then look at the compiler warning.

The particular warning I highlighted is the one fixed by Jacob's recent patch.  
It's something of a proof as to how dangerous that cast is.  I'm happy to take 
a look at others if they can be found (hence I was wondering about Coverity, 
but it looks like we have to submit a change before we can get the results via 
Jenkins).

> As you were able to compile osmo-pcu (a C++ app
> that uses linked lists) it can’t be that bad.

Just to recap, I've complied and ran the following without any additional 
warnings or problems (though I've not ran all the tests, the libosmocore test 
all pass without the cast):

libdbi-0.9.0 libosmo-abis  libosmo-netif openggsn  osmo-bts  
libdbi-drivers-0.9.0  libosmocore   libosmo-sccp openbsc ortp-0.22.0  osmo-pcu 
sqlite-autoconf-3080802

There are many packages in the osmocom git - are there any other significant 
projects which should be checked?  Is there anything significant that Jenkins 
doesn't cover?

Kind Regards,

Mike

Reply via email to