Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!uxc.cso.uiuc.edu!tank!shamash!com50!midgard!syntel!dal From: dal@syntel.UUCP (Dale Schumacher) Newsgroups: comp.os.minix Subject: Re: Future of Minix Summary: Use a SEPARATE library for debugging. Message-ID: <061989A1660@syntel.UUCP> Date: 19 Jul 89 14:14:20 GMT Reply-To: dal@syntel.UUCP (Dale Schumacher) Lines: 37 X-Member-Of: STdNET (ST Developer's Network) In article <19978@louie.udel.EDU> Ronald Lamprecht writes: > Concerning my proposal to introduce debugging stuff into the library I saw > the following responses: > > Andy Tanenbaum (ast@cs.vu.nl) wrote: >> Argh! I think #ifdefs make code very hard to read and ugly. I am not all >> that wild about the idea. > I admit that #ifdef #else #endif constructs are ugly and hard to read, because > they contain two different solutions of the same problem. But common > #ifdef DEBUG #endif shouldn't be that ugly. They contain unique code that may > even be of some interest if you omit it, because they show common sources of > errors. [other comments deleted for brevity] I've long thought that it would be useful to have a library with heavy runtime checking, but I would NOT want to pay ANY overhead price in my final code. What I would suggest is to create a library with conditionally compiled bullet-proofing code built in, then compile with debugging on to get a debugging library and with debugging off to get a library to link with your final production code. Keeping the sources together would help prevent divergence between the two libraries (bugs in one, but not the other being particularly nasty). Since I'm now beginning the process of rewriting part of dLibs (my standard C library for the ST) to bring it up to X3J11 and POSIX conformance (and port it to Minix), I may very well include debugging code as described here. Remember, one very nice trick for conditionally including debugging code is the DEBUG(x) and TRACE(x) macros used in the kernel code. That seems to be a fine way to solve the #ifdef..#endif problem, yet still gain the benefit of aggressive error checking during program development. I feel VERY strongly that I want all that error checking OUT OF THE WAY when I go to create my final program. \\ / Dale Schumacher 399 Beacon Ave. \\ / (alias: Dalnefre') St. Paul, MN 55104-3527 >< ...umn-cs!midgard.mn.org!syntel!dal United States of America / \\ "What is wanted is not the will to believe, but the will to find out, / \\ which is the exact opposite." -Bertrand Russell