From: Nate Eldredge Newsgroups: comp.os.msdos.djgpp Subject: Re: where is __FILE__/__DATE__ ? Date: 17 Aug 2000 00:04:37 -0700 Organization: Posted via Supernews, http://www.supernews.com Lines: 62 Sender: nate AT mercury DOT bitbucket Message-ID: <83sns4v056.fsf@mercury.bitbucket> References: X-Complaints-To: newsabuse AT supernews DOT com User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Radical NetSurfer 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: . 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