Subject: Re: bug#12993: Wrong icon for Cygw32-Emacs

From: Daniel Colascione <[email-masked]>
Date: Mon, 10 Dec 2012 13:05:40 -0800

On 12/10/2012 11:57 AM, Eli Zaretskii wrote:
>> Date: Mon, 10 Dec 2012 08:24:30 -0800
>> From: Daniel Colascione <[email-masked]>
>> CC: [email-masked], [email-masked]
>>
>>>        SetErrorMode (SEM_FAILCRITICALERRORS);
>>>     -
>>>     -  /* Invoke the NT CRT startup routine now that our housecleaning
>>>     -     is finished.  */
>>>     -#ifdef HAVE_NTGUI
>>>     -  /* determine WinMain args like crt0.c does */
>>>     -  hinst = GetModuleHandle (NULL);
>>>     -  lpCmdLine = GetCommandLine ();
>>>     -  nCmdShow = SW_SHOWDEFAULT;
>>>     -#endif
>>>        mainCRTStartup ();
>>>      }
>>>
>>> What do you know about lpCmdLine and nCmdShow, and "what crt0.c does"
>>> with them, to be sure they can be removed?
>>
>> I removed dead code. Those variables are never used; the C runtime (to
>> which we dynamically link anyway) handles this initialization
>> internally.
> 
> I'm not sure.  To me, it looks like we are _replacing_ the _start
> function from the C runtime, and therefore whoever wrote this code
> wanted to do things like the C runtime does.  I see similar code in
> crt0.c from the Windows Platform SDK.  If you know why this is dead
> code, please tell the details.

I don't see that code in my copy of VS10's crt0.c.

The code is useless because it doesn't affect program execution. The symbols
lpCmdLine and nCmdShow are defined only because we define them. (If you declare
them extern without defining them, compilation fails.) Therefore, Emacs is the
only user of these variables. The variables aren't used elsewhere in Emacs code
either.