delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/18/05:15:09

X-Originating-IP: [208.160.246.197]
From: "Nimrod Abing" <n_abing AT hotmail DOT com>
To: djgpp AT delorie DOT com
Cc: radsmail AT juno DOT com
Subject: Re: where is __FILE__/__DATE__ ?
Date: Fri, 18 Aug 2000 17:14:26 PHT
Mime-Version: 1.0
Message-ID: <F288M3oryKFRJrzdDW600003cd9@hotmail.com>
X-OriginalArrivalTime: 18 Aug 2000 09:14:26.0805 (UTC) FILETIME=[B4FF5A50:01C008F4]
Reply-To: djgpp AT delorie DOT com

>From: Radical NetSurfer <radsmail AT juno DOT com>
>Reply-To: djgpp AT delorie DOT com
>To: djgpp AT delorie DOT com
>Subject: Re: where is __FILE__/__DATE__ ?
>Date: Thu, 17 Aug 2000 13:10:36 -0400
>
>On Wed, 16 Aug 2000 12:36:42 -0400, Radical NetSurfer
><radsmail AT juno DOT com> 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....

They do exist because they are _standard_ defines.

>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.

What's ridiculous is companies like Borland (and Microsoft) who like to
take standards and expand them and contort them according to their
whims. What this does is create different and (usually) incompatible
versions of the same thing. I could go on and on with my rants about
this ``embrace and extend'' philosophy in design.

>PLEASE if you can provide a REAL, working example
>for how GCC, or a MAKE file, can display the actual
>date, time of Compile, please show me. THANKS.
>
> >In Borland I can do something this, which I find VERY USEFUL:
> >
> >(topmost line in source)
> >#pragma message Compiling __FILE__ on __DATE__ at __TIME__
> >#pragma message Current Line __LINE__
> >
> >Which, obviously, simply displays, at Compile Time, the Filename of
> >the source-code, and the Date/Time stamp of that particular compile.
> >Likewise, I can see the actual line number whenever desired at any
> >point in my source code...
> >(despite the use of #pragma, my question still relates to having and
> > using __FILE__, etc.)
> >
> >NOW: how would I do this simplistic thing in DJGPP ?

Use a makefile. For each source file, you can make a rule like so:

myfile.o : myfile.c myfile.h others.h
        @date
        @echo 'Compiling $< to $@ . . .'
        @gcc -o $@ $<

This would echo the date and time, followed by the message:
Compiling myfile.c to myfile.o.
The @ before each command prevents the command from being echoed.

If you want to dump this output to a file, use the `redir' program that
comes with DJGPP:

redir -e make.log -o make.log make

Hope this helps.

> >THANKS!
> >
> >Email is welcomed: radsmail AT juno DOT com
> >Http:  members.tripod.com/~RadSurfer/
>


----------------
_nimrod_a_abing_


------------------------------------------
Homepage: http://www.geocities.com/n_abing

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019