[ksh93-integration-discuss] Minimum and maximum values forintegervariables?
Don Cragun
don.cragun at sun.com
Wed Sep 12 13:17:06 PDT 2007
Hi Roland,
Some of the stuff being suggested hears sounds dangerous, but with more
information you might be able to convince me it could work. My
concerns include, but might not be limited to:
1. I don't want to touch csh and dtksh with a twenty foot pole. Even
adding a getconf built-in to /sbin/sh, /usr/bin/sh, /usr/bin/ksh,
/usr/xpg4/bin/sh seems like a lot of work for the number of users
who will care about this feature.
2. Our current /usr/bin/getconf, /usr/xpg4/bin/getconf, and
/usr/xpg6/bin/getconf are complex now and need to be a lot
smarter. They currently only support one programming environment;
they all need to be able to support at least four programming
environments (ILP32_OFF32, ILP32_OFFBIG, LP64_OFF64, and
LPBIG_OFFBIG although some of these may be linked [LP64_OFF64 is
currently identical to LPBIG_OFFBIG]) and be able to call each
other when the -v option specifies conformance to a different set
of standards (SVID3 based [/usr/bin/getconf],
POSIX.1-1990/POSIX.2-1992/XPG4 based [/usr/xpg4/bin/getconf], or
POSIX.1-2001/XPG6 based [/usr/xpg6/bin/getconf]) or a different
programming environment. Adding another dimension to this for
32-bit csh, dtksh, ksh, and 3 versions of sh; as well as 32-bit and
64-bit versions of ksh93 could be burdensome.
3. I realize that ksh93 has a built-in getconf that handles the values
it knows directly, and passes anything else it finds to an
underlying getconf utility; but if we add built-in getconf
utilities to all of the shells it gets increasingly harder to fix
relatively simple getconf bugs and enhancements.
Cheers,
Don
>Date: Sat, 01 Sep 2007 06:52:13 +0200
>From: Roland Mainz <roland.mainz at nrubsig.org>
>
>David Korn wrote:
>[CC:'ing Don Cragun <don.cragun at sun.com> to get some feedback for the
>idea below...]
>> > Robert Neville wrote:
>> > > How can I get the minimum and maximum values for integer variables? Is
>> > > there a counterpart to limits.h to get these values?
>> >
>> > See David Korns answers...
>> > ... one (long-term) idea may be to add special values to the "getconf"
>> > builtin to define the minimum and maximum values for "integer", "float",
>> > the maximum number of array entries and other shell-related limits...
>>
>> In fact the mininum values for integer values are are already
>> supported.
>>
>> getconf LLONG_MIN
>> getconf LLONG_MAX
>>
>> will give the mininum and maximum values for integer in ksh93.
>>
>> As of yet there is now max and min values for float (which
>> is long double).
>
>Erm, my idea was more to have a "standard" way for all shells to get
>these values, e.g. the matching shell would implement their own
>"getconf" builtin and then override values like "SH_INTEGER_MIN",
>"SH_INTEGER_MAX", "SH_FLOAT_DIG" (and all other related stuff from
>/usr/include/iso/float_iso.h), "SH_FLOAT_MIN", "SH_FLOAT_MAX" etc. -
>AFAIK there are already values for /usr/bin/bc somewhere in the POSIX
>spec (e.g. "BC_BASE_MAX") and maybe the same could be done for the
>shells, too.
>
>----
>
>Bye,
>Roland
More information about the ksh93-integration-discuss
mailing list