kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #26475
Re: [PATCH] Remove check for undefined behaviour
I normally don't like to rant but OMFG! I just looked at the code path
that lead to this wonderful piece of code and I'm now regretting that.
You just cannot unsee that. See if you can follow the logic (assuming
logic was actually used to write this code) backwards from
Triangle::NeighborAcross(). I'm not sure removing the invalid null
reference checks is a good idea even though I've seen the compiler
complain about it and agree with it. In what universe do you blindly
convert a potentially NULL pointer into a C++ reference, pass it to the
caller, and go merrily on you way? This really needs to be rewritten
using pointers with the appropriate NULL pointer checks along the way.
It's hard to imagine this ever worked properly.
On 9/27/2016 1:33 PM, Simon Richter wrote:
>
> Triangle::NeighborAcross returns a reference, which must refer to a valid
> object whose address cannot be 0. Thus, this test is nonsensical.
> ---
> polygon/poly2tri/sweep/sweep.cc | 16 ----------------
> 1 file changed, 16 deletions(-)
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
>
Follow ups
References