Re: Gengetopt 2.21 enhancement suggestions
Lorenzo Bettini <[email protected]> Tue, 16 Oct 2007 16:37:33 +0200
| Newsgroups | gmane.comp.gnu.gengetopt.general |
|---|---|
| Message-ID | <[email protected]> |
Andre Noll wrote:
> On 17:35, Lorenzo Bettini wrote:
>
>>>> of course range makes sense only for integers right?
>>> It would also make sense for floats. And it would be nice to also have
>>> "infinite" intervals, i.e. something like "int range=0.." meaning
>>> the given integer value must not be negative.
>>>
>> anyway, only for numerical values, right?
>
> <mathematician hat on> For all type of options such that the
> underlying set carries a canonical partial order <mathematician
> hat off>.
>
:-D
> This includes strings as well:
>
> string range="bar..baz"
>
> means that the given string must be between "bar" and "baz" in
> the lexicographical order.
>
> Note that the "right" lexicographical order depends on the current
> locale which is probably a bit strange. As a locale-independent
> variant, one could use
>
> strcmp("bar", arg) <= 0 && strcmp(arg, "baz") <= 0
>
> to test whether arg is valid.
>
> However, I'm not sure at all if the range thing is really useful for
> non-numerical values.
well, since it is to be implemented, probably it's better to implement
it for all types...
--
Lorenzo Bettini, PhD in Computer Science, DSI, Univ. di Firenze
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net