From: Sinan_Unur AT mail DOT com (A. Sinan Unur) Newsgroups: comp.os.msdos.djgpp Subject: Re: where is __FILE__/__DATE__ ? Date: 17 Aug 2000 18:59:27 GMT Organization: Cornell University Lines: 55 Sender: verified_for_usenet AT cornell DOT edu (asu1 on 128.253.251.163) Message-ID: <8F939C20CASINANUNUR@132.236.56.8> References: <1u6ops46pog5cggn1o102tlig0msdqkmeo AT 4ax DOT com> NNTP-Posting-Host: 128.253.251.163 X-Trace: news01.cit.cornell.edu 966538767 26477 128.253.251.163 (17 Aug 2000 18:59:27 GMT) X-Complaints-To: usenet AT news01 DOT cit DOT cornell DOT edu NNTP-Posting-Date: 17 Aug 2000 18:59:27 GMT User-Agent: Xnews/03.04.11 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com radsmail AT juno DOT com (Radical NetSurfer) wrote in <1u6ops46pog5cggn1o102tlig0msdqkmeo AT 4ax DOT com>: >On Wed, 16 Aug 2000 12:36:42 -0400, Radical NetSurfer > wrote: > >>Does DJGPP suppport __FILE__, __DATE__, __LINE__, etc? > >Apparently these do exist, since when I >#define __FILE__ foo_bar >I get a re-definition error.... > >I still have NO CLUE how to get these to display during compile >times. I think it rediculuous that #message does not exist, >or that #warning does not expand macro's. >Thats why people use Borland, etc. why do you want to display the name of the file you are compiling, and the date etc? if there is an error/warning, gcc gives you the information: C:\tmp>gcc -c c.c -Wall c.c: In function `main': c.c:4: warning: `return' with no value, in function returning non-void (assuming you know the date you are compiling the file). now, the standard way of using those macros is to convey the module, date, line information at RUN time (example lifted directly from the CPP documentationt that Nate mentioned earlier): fprintf (stderr, "Internal error: " "negative string length " "%d at %s, line %d.", length, __FILE__, __LINE__); also, #include int main(void) { return printf("%s compiled on %s at %s\n", __FILE__, __DATE__, __TIME__); } C:\tmp>gcc c.c -o c.exe -Wall C:\tmp>c c.c compiled on Aug 17 2000 at 14:57:27 -- -------------------------------- A. Sinan Unur http://www.unur.com/