On Tue, Jun 25, 2019 at 12:29 PM Cong Wang <xiyou.wangc...@gmail.com> wrote: > > On Tue, Jun 25, 2019 at 11:07 AM Cong Wang <xiyou.wangc...@gmail.com> wrote: > > On one hand, its callers should not need to worry about details > > like overflow. On the other hand, in fact it does exactly what its > > callers tell it to do, the problematic part is actually the > > incremented id. On 64bit, it is fairly easy, we can just simply > > know 'long' is longer than 32bit and leverage this to detect overflow, > > but on 32bit this clearly doesn't work. > > > > Let me think about it. > > Davide, do you mind to try the attached patch? > > It should handle this overflow case more gracefully, I hope.
Well, it looks like it would miss UINT_MAX... Let me see how this can be fixed.