Boost logo

Boost :

From: Thomas Wenisch (twenisch_at_[hidden])
Date: 2002-10-22 14:05:01


Hartmut,

On Tue, 22 Oct 2002, Hartmut Kaiser wrote:

> Peter Dimov wrote:
>
> > > After what your code looks like:
> > >
> > > nonctl_char = urange_p( '\x21', '\xFF' );
> >
> > The question is, would you ever want ['\x21', '\xFF'] to
> > _not_ be a valid
> > range?
>
> If this is what you want, you could write 'epsilon_p - urange_p( '\x21',
> '\xFF' )', essentially this means 'match everything (epsilon_p) except
> ('-') the given range :-)
>

Perhaps I misread Peter's post, but I understood his question to mean,
why is the assertion error useful? Why would we want range_p to assert if
the lower bound > upper bound? (Peter, correct me if I am misinterpreting
your question).

If this causes users headaches because of the signed-ness of char, why
not simply reverse the bounds, since this almost certainly what was
intended. Here, I think it would be better for the code to simply work,
instead of issuing a runtime diagnostic of questionable usefulness.

Thoughts?

-Tom Wenisch
Computer Achitecture Lab
Carnegie Mellon University


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk