Re: [PATCH 2/9] commit-graph: stop using signed integers to count bloom filters
Oswald Buddenhagen <oswald.buddenhagen@gmx.de> writes:
Show 16 quoted lines
> On Wed, Aug 06, 2025 at 08:23:36AM +0200, Patrick Steinhardt wrote:
>>If I see a counting variable that is signed I immediately jump to the
>>question of whether or not it can ever be a negative value. I assume
>>that the author of this code _intentfully_ made it signed to cater to a
>>specific edge case.
>>
> well, there is also the diametrically opposed view:
> https://google.github.io/styleguide/cppguide.html#Integer_Types
> https://critical.eschertech.com/2010/04/07/danger-unsigned-types-used-here/
> https://soundsoftware.ac.uk/c-pitfall-unsigned
> https://stackoverflow.com/questions/30395205/why-are-unsigned-integers-error-prone
> ..
>
> in isync, i standardized on unsigned where possible (e2d3b4d55), and
> sure enough, i introduced one of those underflow bugs not much later
> (859b7dd7f => 12e30ce56) ...
Thanks for an amusing reading list ;-)