Mail Archives: djgpp/2000/08/17/03:45:32
Radical NetSurfer <radsmail AT juno DOT com> writes:
> Does DJGPP suppport __FILE__, __DATE__, __LINE__, etc?
Yes.
info cpp "Standard Predefined Macros"
> I saw that __STDC__ exists, __GNUC__, only.
>
>
> 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 ?
GCC doesn't have #pragma message. The closest thing is #warning, and
it doesn't expand macros in its argument. So it appears you can't do
this per se.
I suggest you make the logging part of your build scripts instead of
part of the source file. The compilation command will have the
filename, and the `date' command should take care of the rest.
Of course, you can still use these macros for run-time messages.
> If they are currently not a feature, dear Mr. D.J., PLEASE add them.
You are welcome to suggest it to the gcc maintainers: <gcc AT gnu DOT org>.
But I rather suspect they won't be interested.
> I know that my compiled programs look very nice now when I use
> these features sparingly and wisely. And when re-directed into a file
> for logging purposes, the Date and Time prove vital!!
>
> alternative (temporary) solution:
>
> date
> time
> gcc ...
> cleanup
>
> in a batch file...sheesh.
Doesn't look that bad to me. At least the part that spits out the
date and time is obvious and isolated, rather than scattered across
all your sources.
--
Nate Eldredge
neldredge AT hmc DOT edu
- Raw text -