On Thu, 2024-07-11 at 13:01 -0400, Benjamin Marzinski wrote:
> On Thu, Jul 11, 2024 at 01:08:39PM +0200, Martin Wilck wrote:
> > On Wed, 2024-07-10 at 18:54 -0400, Benjamin Marzinski wrote:
> > > 
> > > we should probably use "part%u-%n" so we can't match a "-" before
> > > the
> > > number.
> > 
> > That doesn't work, %u accepts negative numbers, too
> > (https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf)
> > That's why I use int and check whether the result is positive.
> 
> Huh? I learned something new. I actually find that kind of annoying,

I know, I was also surprised when I found out. But strtoul() behaves
like this, too. In C, it's perfectly ok to write

        unsigned int n = -1;

Maybe that's how we should look at it.

Martin


Reply via email to