This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Dangerous glibc byte/wide stream interactions
- To: linux-utf8 at nl dot linux dot org
- Subject: Re: Dangerous glibc byte/wide stream interactions
- From: Henry Spencer <henry at spsystems dot net>
- Date: Sun, 24 Sep 2000 18:32:36 -0400 (EDT)
- cc: libc-alpha at sources dot redhat dot com
On 24 Sep 2000, Ulrich Drepper wrote:
> > a check (if mode != rightmode {die with snide comment}) would seem
> > appropriate...
>
> No. This is no debugging library, it's a runtime library.
The two are not necessarily mutually exclusive. See the classic comment,
by Tony Hoare I think, about wearing lifejackets on your training cruises
and then leaving them behind when you actually go to sea.
It is well worth accepting a *small* amount of overhead for sanity checks.
Sometimes they catch things. Saying that this belongs in a debugging
library implies that there is a sharp boundary between debugging and
production -- that production code has no bugs -- but the real world does
not work that way.
Certainly in my own work, I have found it well worthwhile to retain quite
extensive internal self-checking -- much more substantial than what is
being proposed here -- into the "production" version. It has caught many
problems which would otherwise have bedeviled users.
The debate should center on whether there is *too much* overhead involved,
and on whether this particular sanity check is useful *enough* to justify
its overhead, not on whether sanity checks belong in run-time libraries at
all. Some of them do, at least until that happy day when we have enough
support from languages and compilers to do such checking at compile time.
Henry Spencer
henry@spsystems.net