This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Dangerous glibc byte/wide stream interactions


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]