Re: Add compiled date to git --version output?
- From
Brian Gernhardt <brian@gernhardtsoftware.com>
- Date
- Sep 18, 2009, 04:43 UTC
- Message-ID
- <F73940A6-02F5-48EE-BD11-FCEC5B21B054@gernhardtsoftware.com>
- In-Reply-To
- <544dda350909172117r44761577m11e7d30a1a5d0c91@mail.gmail.com>
On Sep 18, 2009, at 12:17 AM, Nazri Ramliy wrote:
> + printf("git version %s compiled %s %s\n",
> + git_version_string,
> + __DATE__,
> + __TIME__);> Thoughts?
Any idea how compatible that is? Sure, it'll work with GCC's cpp, but we try to work with a huge variety of compilers.
At the very least you might want to wrap it all in #ifdefs or something:
#if defined(__DATE__) && defined(__TIME__) /* your version */ #else /* old version */ #endif
(Or play fun tricks with #ifndef ... #define, but then you also have to play with the format string or something.)
~~Brian