[libstdc++ PATCH] libstdc++ debug mode (fourth try)
Doug Gregor
dgregor@apple.com
Wed Aug 6 15:33:00 GMT 2003
On Wednesday, August 6, 2003, at 6:58AM, Pétur Runólfsson wrote:
> Hi,
>
> Just a small nit about the documentation:
>
> Index: docs/html/debug.html
> [...]
> ! <p>libstdc++ includes many extensions to the C++ standard library. In
> ! some cases the extensions are obvious, such as the hashed
> ! associative containers, whereas other extensions give predictable
> ! results to behavior that would otherwise be undefined, such as
> ! throwing an exception when a <code>std::basic_string</code> is
> ! constructed from a NULL character pointer. This latter category
> also
> ! includes implementation-defined and unspecified semantics,
>
> The last sentence seems somewhat misleading. Implementation-defined
> behaviour (as defined in 1.3.5) is quite distinct from undefined
> behaviour, and is (or should be) predictable (since it is required to
> be
> documented). Unspecified behaviour is also different from undefined
> behaviour, and is not an extension.
But in all cases you are relying upon behavior that the C++ standard
does not guarantee, so your code may not be portable to other
implementations of the standard library.
> Also, I don't see any place where the debug mode warns about
> implementation-defined or unspecified behaviour (but I may be missing
> something).
There aren't many places where this occurs, but vector capacity is one
of them: in pedantic mode, the vector tracks the capacity that is
guaranteed by the standard, e.g., the greatest size the container has
attained or the largest value that has been passed to reserve().
Strings provide examples of libstdc++ extensions that we'll complain
about, because construction with a NULL string is undefined behavior
but libstdc++ throws an exception.
Doug
More information about the Libstdc++
mailing list