Xref: utzoo comp.lang.c:28560 comp.unix.wizards:21872 alt.sources:1851 comp.sources.d:5304 misc.misc:9696 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!samsung!zaphod.mps.ohio-state.edu!van-bc!robinson Newsgroups: comp.lang.c,comp.unix.wizards,alt.sources,comp.sources.d,misc.misc Subject: Re: #define DEBUG... (using printf for debugging) Message-ID: <1990May8.183211.2661@mdivax1.uucp> Date: 8 May 90 18:32:11 GMT References: <11290@hoptoad.uucp> <40628@cornell.UUCP> <801@oz.rci.dk> Reply-To: mdivax1!robinson (Jim Robinson) Organization: Mobile Data International, Richmond, B.C., Canada Lines: 28 Return-Path: Apparently-To: van-bc!rnews In article <801@oz.rci.dk> kc@oz.rci.dk (Knud Christensen) writes: >The following, which i found in a magazine solves the problem very elegantly i >think: > >/* > debug.h > > This header file gives a number of usefull definitions for debugging >*/ > >#ifdef debug ># define DFPRINTF(x) fprintf x ># define DTRACE fprintf(stderr, "Trace line %d\n", __LINE__) ># define DTRINT(var) fprintf(stderr, "Trace line %d var = %d\n", __LINE__, var) >#else ># define DFPRINTF(x) ># define DTRACE ># define DTRINT(var) >#endif > >/* > End of debug facility definitions >*/ Isn't the use of __LINE__ non-portable? -- Jim Robinson {uunet,ubc-cs}!van-bc!mdivax1!robinson