git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: Junio C Hamano <gitster@pobox.com>
Cc: Ramsay Jones <ramsay@ramsay1.demon.co.uk>,
	GIT Mailing-list <git@vger.kernel.org>
Subject: Re: [PATCH 6/6] sparse: Fix mingw_main() argument number/type errors
Date: Mon, 29 Apr 2013 18:10:48 +0200	[thread overview]
Message-ID: <517E9B88.1040807@lsrfire.ath.cx> (raw)
In-Reply-To: <7v38uaqwow.fsf@alter.siamese.dyndns.org>

Am 28.04.2013 21:31, schrieb Junio C Hamano:
> René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:
>
>> Why not take the opposite direction with a patch like this?
>> ...
>> diff --git a/compat/mingw.h b/compat/mingw.h
>> index 389ae01..74e7b87 100644
>> --- a/compat/mingw.h
>> +++ b/compat/mingw.h
>> @@ -452,11 +452,11 @@ int xwcstoutf(char *utf, const wchar_t *wcs, size_t utflen);
>>
>>   void mingw_startup();
>>   #define main(c,v) dummy_decl_mingw_main(); \
>> -static int mingw_main(); \
>> +static int mingw_main(int, const char **); \
>>   int main(int argc, const char **argv) \
>
> But traditionally main is declared like
>
> 	int main(int argc, char *argv[]);
>
> without const, no?

Yes, http://c-faq.com/ansi/maindecl.html and basically everybody else 
agree.  Now that I actually think about it, the only benefit of 
declaring argv constant I can find is that the const'ness could easily 
spread to other variables and function arguments where it may actually 
matter.  So please ignore my interjection.  Or perhaps it might be worth 
mentioning in the commit message that removal of that "const" improves 
the code's standard compliance.

René

  reply	other threads:[~2013-04-29 16:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-27 19:19 [PATCH 6/6] sparse: Fix mingw_main() argument number/type errors Ramsay Jones
2013-04-28  0:31 ` René Scharfe
2013-04-28 19:31   ` Junio C Hamano
2013-04-29 16:10     ` René Scharfe [this message]
2013-04-29 23:30       ` Ramsay Jones
2013-04-29 21:52   ` Ramsay Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=517E9B88.1040807@lsrfire.ath.cx \
    --to=rene.scharfe@lsrfire.ath.cx \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ramsay@ramsay1.demon.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).