[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gnulib] addition: size_max.m4, ptrdiff_max.m4
From: |
Bruno Haible |
Subject: |
Re: [Bug-gnulib] addition: size_max.m4, ptrdiff_max.m4 |
Date: |
Thu, 13 Nov 2003 12:48:23 +0100 |
User-agent: |
KMail/1.5 |
Paul Eggert wrote:
> > dnl The _AC_COMPUTE_INT macro works up to LONG_MAX, since it uses
> > 'expr', dnl which is guaranteed to work from LONG_MIN to LONG_MAX.
> > ...
> > _AC_COMPUTE_INT([~(size_t)0 / 10], res_hi,
> > [#include <stddef.h>], result=?)
> > _AC_COMPUTE_INT([~(size_t)0 % 10], res_lo,
> > [#include <stddef.h>], result=?)
>
> Ouch. This is a hassle. Perhaps Autoconf should be fixed so that
> _AC_COMPUTE_INT can handle values outside the range
> LONG_MIN..LONG_MAX? That would be better than having to do this sort
> of thing by hand all the time. (This wouldn't fix the immediate
> problem of course; I'm thinking more long-term.)
'expr' is certainly the easiest auxiliary program that can be used to
compute "2*x" and "(x+y)/2" for some integers x and y, but it's not the
only one. You could also use 'sed' for this purpose. The only problem with
'sed' in this place is aesthetics: a 'sed' program for "y = x+1" is
ca. 18 lines of code in 'sed', so I guess for "z = x+y" you'll need 50
or 100 sed statements.
Bruno
- Re: [Bug-gnulib] addition: size_max.m4, ptrdiff_max.m4,
Bruno Haible <=