Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site h-sc1.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!h-sc1!augart From: augart@h-sc1.UUCP (Steven Augart) Newsgroups: net.lang.c Subject: Re: How about a predefined #FILE, #PATH and #FUNCTION for C? Message-ID: <887@h-sc1.UUCP> Date: Mon, 27-Jan-86 17:43:02 EST Article-I.D.: h-sc1.887 Posted: Mon Jan 27 17:43:02 1986 Date-Received: Wed, 29-Jan-86 06:36:18 EST References: <312@yale.ARPA Organization: Harvard Univ. Science Center Lines: 22 I cannot claim to speak about other versions of unix, but in Berkeley 4.2 and 4.3, there are two macros automatically defined for you by the c preprocessor: __FILE__ and __LINE__. Here's how I use them: char * foo; char * malloc(); unsigned room; [ code .... ] if ((foo = malloc(room)) == (char *) NULL) { fprintf(stderr, "Out of memory on line %d of file %s!\n", __LINE__, __FILE__); exit(1); } Could someone on a non-4.2/4.3 BSD machine tell us if this facility is part of other preprocessors as well? Thanks. Steven Augart swa@borax.lcs.mit.edu (617) 498-6352