From: Jeff King Date: Tue, 20 May 2014 06:21:32 GMT Subject: Re: [PATCH v2] format-patch --signature-file Message-ID: <20140520062132.GA5222@sigill.intra.peff.net> In-Reply-To: <20140520054621.GA28317@hudson.localdomain> On Mon, May 19, 2014 at 10:46:21PM -0700, Jeremiah Mahler wrote: > > Avoiding that is easy with an indirection, no? Something like this > > at the top: > > > > static const char *the_default_signature = git_version_string; > > static const char *signature = the_default_signature; > > > > and comparing to see if signature points at the same address as > > the_default_signature would give you what you want, I think. > > I like your suggestion for a default signature variable. > Unfortunately, C doesn't like it as much. > > static const char *the_default_signature = git_version_string; > static const char *signature = the_default_signature; // ERROR > // initializer element is not constant You could do: #define DEFAULT_SIGNATURE git_version_string static const char *signature = DEFAULT_SIGNATURE; ... if (signature == DEFAULT_SIGNATURE) ... but maybe that is getting a little unwieldy, considering the scope of the original problem. -Peff