Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!virtech!cpcahil From: cpcahil@virtech.UUCP (Conor P. Cahill) Newsgroups: comp.lang.c Subject: Re: __LINE__ and __FILE__ -- a beginner's question Summary: How about error messages and debugging messages Message-ID: <1267@virtech.UUCP> Date: 13 Oct 89 01:24:01 GMT References: <6257@arcturus> Organization: Virtual Technologies Inc Lines: 19 In article <6257@arcturus>, evil@arcturus.UUCP (Wade Guthrie) writes: > For what purpose are the __LINE__ and __FILE__ macros used? Are these > only useful for the writers of code that, in turn, produces compileable > code, or is there some use for the applications programmer? I usually use these for debugging messages: fprintf(stderr,"%s(%d): message\n", __FILE__,__LINE__); and for logfile messages of the same format. Of course, each time you use __FILE__, you get a separate string added to your data space, so I would limit this to development code and strip most of it out of production code (using #ifdefs of course). -- +-----------------------------------------------------------------------+ | Conor P. Cahill uunet!virtech!cpcahil 703-430-9247 ! | Virtual Technologies Inc., P. O. Box 876, Sterling, VA 22170 | +-----------------------------------------------------------------------+