News for hackers. Stuff that matters.
Re:My favourite C++ footgun by kaik on Tuesday June 22, 2021 @06:21PM (#27597984)
I kid you not, I spent a full working day debugging this exact same issue (taking a pointer to a vector element, before adding more elements). Very obvious if you understand how C++ and vectors work, yet it took me forever to realize, and it was miserable…
Re:My favourite C++ footgun by saagarjha on Tuesday June 22, 2021 @08:04PM (#27599030)
Heh, you can run into this even if you understand how iterator invalidation works. Once you see the bug it's easy to understand, but finding it might not be…
Re:My favourite C++ footgun by account42 on Wednesday June 23, 2021 @06:45AM (#27602957)
> finding it might not be…

Valgrind memcheck is your friend.

Re:My favourite C++ footgun by gpderetta on Wednesday June 23, 2021 @07:15AM (#27603123)
also asan.