Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: Notesfiles $Revision: 1.7.0.10 $; site ccvaxa Path: utzoo!watmath!clyde!cbosgd!ihnp4!inuxc!pur-ee!uiucdcs!ccvaxa!aglew From: aglew@ccvaxa.UUCP Newsgroups: net.lang.c Subject: Re: How about a predefined #FILE, #PATH Message-ID: <2600036@ccvaxa> Date: Tue, 28-Jan-86 22:31:00 EST Article-I.D.: ccvaxa.2600036 Posted: Tue Jan 28 22:31:00 1986 Date-Received: Sat, 1-Feb-86 01:20:05 EST References: <312@yale.ARPA> Lines: 24 Nf-ID: #R:yale.ARPA:312:ccvaxa:2600036:000:797 Nf-From: ccvaxa.UUCP!aglew Jan 28 21:31:00 1986 Aztec C on the IBM PC has the "predefined variable names" __FILE__, __LINE__, __FUNC__, which are actually compile time "constants" at any place in the code (macros work fine). Combining these with the new standard for concatenation of string constants made it easy to produce some half-decent error messages: puts("Error in " __FUNC__ " at line " __LINE__ " of file " __FILE__); Unfortunately, although this was described in the manual, it didn't work in the version of the compiler we had. I don't have a manual for the ANSI C standard, so I don't know if these are included. PS. If you really want to use #defines, something like this csh alias might be useful: alias CC cc -DFILE=\!:1 \!:1.c -o \!:1 and a little lexer can do the required substitutions for line number and function.