On Sun, Nov 28, 2021 at 2:45 PM Paul Smith <psm...@gnu.org> wrote:
> On Sun, 2021-11-28 at 08:24 +0100, Jouke Witteveen wrote:
> > Thanks for sending this message, I would have otherwise prepared and
> > sent an updated patch series today. My plan was to expand to RHS in
> > the two-argument case if both values are equal. I assume you also
> > updated the documentation where needed? If so, there's nothing I have
> > to add and I'm looking forward to the new functionality.
> Yes, I updated the docs.
> Since the two arguments are equal, it doesn't matter which of LHS or
> RHS we return.

They could differ for instance when one of them contains a '+'-sign.
My reason for using LHS is that we already have a string for it. By
using sprintf, we need to make the buffer big enough, which in turn
requires INTSTR_LENGTH to be fitting for whatever width a long has on
the current platform.

> The change I made was:
>   argv += 2;
>   if (*argv == NULL)
>     {
>       if (lhs == rhs)
>         {
>           char buf[INTSTR_LENGTH+1];
>           sprintf (buf, "%ld", lhs);
>           o = variable_buffer_output(o, buf, strlen (buf));
>         }
>       return o;
>     }
> However, now that I think about it I need to change the code more: we
> need to be using "long long" here not just "long".  While on Linux etc.
> a "long" is 8 bytes, on Windows "long" is only 4 bytes.

I was hoping this would not be necessary, and I cannot think of a
typical use case where make is a good fit for dealing with large
integers. The benefit of "long" is that strtol is more widely
available than strtoll.

- Jouke

Reply via email to