Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pasteur!helios.ee.lbl.gov!ncis.tis.llnl.gov!lll-winken!uunet!mcvax!hp4nl!botter!star.cs.vu.nl!ast From: ast@cs.vu.nl (Andy Tanenbaum) Newsgroups: comp.os.minix Subject: Re: Re^2: Future of Minix Message-ID: <2897@ast.cs.vu.nl> Date: 17 Jul 89 19:43:18 GMT References: <19654@louie.udel.EDU> <2885@ast.cs.vu.nl> <465@medusa.informatik.uni-erlangen.de> Reply-To: ast@cs.vu.nl (Andy Tanenbaum) Organization: VU Informatica, Amsterdam Lines: 29 In article <465@medusa.informatik.uni-erlangen.de> dkhusema@immd4.informatik.uni-erlangen.de (Dirk Husemann) writes: > How about using the #ifdef-#endif constructs at a different place >E.g. >#ifdef DEBUG >#define DB2(format, arg1, arg2) /* something to print the args accor- >#define DB3(format, arg1, arg2, arg3) /* ditto */ >#else /* DEBUG */ I agree that something along those lines would be an improvement. Also, call them DEBUG2 and DEBUG3 instead of DB2 and DB3. Even better is to use assertions. Things like: ASSERT(x < y && z != 0); could be handled by #ifdef DEBUG #define ASSERT(predicate) if (!(predicate)) printf("Assertion error ...\n"); #else #define ASSERT(predicate) /* nothing */ #endif I think assertions have utility as comments even when no code is generated. There is already a file assert.h in V1.3. The only thing wrong with it is that instead of #ifdef DEBUG, it says #ifdef NDEBUG. I think NDEBUG is 10x harder to understand. Andy Tanenbaum (ast@cs.vu.nl)