Thread overview | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
March 07, 2005 Do we have __DATE__ ?? | ||||
---|---|---|---|---|
| ||||
Or __FILE__, __LINE__, etc. etc.? I really need __DATE__ |
March 07, 2005 Re: Do we have __DATE__ ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | On Mon, 7 Mar 2005 23:07:51 +1100, Matthew wrote: > Or __FILE__, __LINE__, etc. etc.? > > I really need __DATE__ Hear! Hear!. I also would love to have these compiler generated values. They can give meaningful information to people who are trying to find errors happening at a customer's site. It helps narrow down what version they are running and where a run-time message is really coming from. -- Derek Parnell Melbourne, Australia 7/03/2005 11:09:23 PM |
March 07, 2005 Re: Do we have __DATE__ ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | I also need __FILE__, __LINE__. __DATE__ |
March 07, 2005 Re: Do we have __DATE__ ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | Matthew wrote: > Or __FILE__, __LINE__, etc. etc.? Are these actually that useful in a language that doesn't have a macro preprocessor? > I really need __DATE__ Date of what? The file's timestamp? When it is compiled? What data type/format would it be? A d_time? (Most sensible for as long as d_time remains the nearest we have to a standard date type.) A string as formatted using std.date.toDateString or std.date.toString? Something else? And do we really want to use reserved identifiers for this? Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit. |
March 07, 2005 Re: Do we have __DATE__ ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | Matthew wrote:
> Or __FILE__, __LINE__, etc. etc.?
>
> I really need __DATE__
I'd go further and introduce __FUNC__ which gives us the function name and also __MODULE__, which gives us, right, the module name. This would be really neat, I need some of them, too!
|
March 07, 2005 Re: Do we have __DATE__ ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Matthew | Matthew wrote:
> Or __FILE__, __LINE__, etc. etc.?
>
> I really need __DATE__
But aren't __FILE__, __LINE__, __DATE__, __TIME__ all
part of that ancient old preprocessor which is so evil ? ;-)
I also find the GCC extension __FUNCTION__ to be useful.
Wouldn't it be possible to add these as constants to
the lexer, without messing up the language to bad ?
Or it could be like an escape sequence or something...
But easiest would just be if they were "special" literals.
char[] file = __FILE__;
int line = __LINE__;
char[] date = __DATE__; // "??? ?? ????"
char[] time = __TIME__; // "??:??:??"
char[] module = __MODULE__;
char[] function = __FUNCTION__;
Doesn't sound impossible to hack into the DMD front-end...
--anders
|
March 07, 2005 Re: Do we have __DATE__ ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | Stewart Gordon wrote: >> I really need __DATE__ > > Date of what? The file's timestamp? When it is compiled? When it is compiled... http://gcc.gnu.org/onlinedocs/cpp/Standard-Predefined-Macros.html > What data type/format would it be? A d_time? (Most sensible for as long as d_time remains the nearest we have to a standard date type.) A string as formatted using std.date.toDateString or std.date.toString? Something else? Something else: __DATE__ = "Mar 7 2005"; __TIME__ = "15:44:00"; > And do we really want to use reserved identifiers for this? Well, we *could* use date and time and file and line... It would "silently break" a couple of dozen people's code, but they should be used to that since length ? ;-) --anders |
March 07, 2005 Re: Do we have __DATE__ ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | >> Or __FILE__, __LINE__, etc. etc.?
>
>Are these actually that useful in a language that doesn't have a macro preprocessor?
It is very usefull!
And why "preprocessor"? This is "compiler-predefined constants".
|
March 07, 2005 Re: Do we have __DATE__ ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Derek Parnell | Build can do that, it's exactly the same thing as plugins. I explained how we could do it in my last post: http://www.dsource.org/forums/viewtopic.php?t=624 Le Mon, 07 Mar 2005 23:12:14 +1100, Derek Parnell a écrit : > On Mon, 7 Mar 2005 23:07:51 +1100, Matthew wrote: > >> Or __FILE__, __LINE__, etc. etc.? >> >> I really need __DATE__ > > Hear! Hear!. I also would love to have these compiler generated values. They can give meaningful information to people who are trying to find errors happening at a customer's site. It helps narrow down what version they are running and where a run-time message is really coming from. |
March 07, 2005 Re: Do we have __DATE__ ?? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Lukas Pinkowski | Nice suggestion. I have added it to my wish list under compiler values. http://all-technology.com/eigenpolls/dwishlist/ On Mon, 07 Mar 2005 15:33:35 +0100, Lukas Pinkowski wrote: > Matthew wrote: > >> Or __FILE__, __LINE__, etc. etc.? >> >> I really need __DATE__ > > I'd go further and introduce __FUNC__ which gives us the function name and also __MODULE__, which gives us, right, the module name. This would be really neat, I need some of them, too! |
Copyright © 1999-2021 by the D Language Foundation