empty slices: defined?
Gabriel Dos Reis
gdr@integrable-solutions.net
Mon Nov 7 21:28:00 GMT 2005
DJ Delorie <dj@redhat.com> writes:
| > I guess the question I have is what would you do with an empty
| > slice? What useful purpose does it serve?
|
| Nobody said it was useful, but that doesn't mean someone won't find a
| use for it somewhere. Fortunately, I wasn't asking it if was useful,
| just legal ;-)
Oh, I assumed you were applying the general provision that lack of
description of behaviour is equivalent to "undefined behaviour",
and consequently you're asking for whether it would make sense to
extend the specification to cover those boundary conditions.
| > In general, valarray is specificed in such a way that its
| > implementation shall not check for "boundary" conditions.
|
| I was hoping to get a "the spec says thusly" type of response.
OK, the general type of answer is that lack of description of
behaviour is "undefined behaviour" :-)
| *Where* in the spec does it say it doesn't check for boundary
| conditions?
The spec does not say "don't check for boundary conditions", because
there is no such thing as "boundary conditions" in Standardese.
However, that does not imply that the specification did not have
a design rule not formally translated into Standardese. For example,
there are various places where the spec says that operations between
between valarrays of unequal size is undefined behaviour, and
other restrictions on the type you can use to instantiate or
construct valarrays.
-- Gaby
More information about the Libstdc++
mailing list