[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/3] Introduce $(compare ...) for numerical comparison
From: |
Jouke Witteveen |
Subject: |
Re: [PATCH 3/3] Introduce $(compare ...) for numerical comparison |
Date: |
Sun, 28 Nov 2021 14:57:12 +0100 |
On Sun, Nov 28, 2021 at 2:45 PM Paul Smith <psmith@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.
Regards,
- Jouke
- Re: [PATCH 3/3] Introduce $(compare ...) for numerical comparison, Jouke Witteveen, 2021/11/05
- Re: [PATCH 3/3] Introduce $(compare ...) for numerical comparison, Paul Smith, 2021/11/08
- Re: [PATCH 3/3] Introduce $(compare ...) for numerical comparison, Jouke Witteveen, 2021/11/10
- RE: [PATCH 3/3] Introduce $(compare ...) for numerical comparison, rsbecker, 2021/11/10
- Re: [PATCH 3/3] Introduce $(compare ...) for numerical comparison, Paul Smith, 2021/11/14
- Re: [PATCH 3/3] Introduce $(compare ...) for numerical comparison, Jouke Witteveen, 2021/11/15
- Re: [PATCH 3/3] Introduce $(compare ...) for numerical comparison, Paul Smith, 2021/11/27
- Re: [PATCH 3/3] Introduce $(compare ...) for numerical comparison, Jouke Witteveen, 2021/11/28
- Re: [PATCH 3/3] Introduce $(compare ...) for numerical comparison, Paul Smith, 2021/11/28
- Re: [PATCH 3/3] Introduce $(compare ...) for numerical comparison,
Jouke Witteveen <=
- Re: [PATCH 3/3] Introduce $(compare ...) for numerical comparison, Paul Smith, 2021/11/28
- Re: [PATCH 3/3] Introduce $(compare ...) for numerical comparison, Jouke Witteveen, 2021/11/28
- Re: [PATCH 3/3] Introduce $(compare ...) for numerical comparison, Paul Smith, 2021/11/28
- Re: [PATCH 3/3] Introduce $(compare ...) for numerical comparison, Paul Smith, 2021/11/28
- Re: [PATCH 3/3] Introduce $(compare ...) for numerical comparison, Jouke Witteveen, 2021/11/28
- Re: [PATCH 3/3] Introduce $(compare ...) for numerical comparison, Edward Welbourne, 2021/11/16
- Re: [PATCH 3/3] Introduce $(compare ...) for numerical comparison, Jouke Witteveen, 2021/11/16