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

-- 
  __ .  . __
 (o.\ \/ /.o) roland.mainz at nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)

Reply via email to