Re: passing arg 2 of 'NSApplicationMain' from incompatible pointer
Re: passing arg 2 of 'NSApplicationMain' from incompatible pointer
- Subject: Re: passing arg 2 of 'NSApplicationMain' from incompatible pointer
- From: matt neuburg <email@hidden>
- Date: Wed, 18 Feb 2004 18:19:18 -0800
On Thu, 19 Feb 2004 10:15:10 +1300, Denis Stanton <email@hidden>
said:
>
can anyone explain why I get the above warning message when I compile
>
for deployment?
I raised this last month on xcode-users. I got this reponse from Eric Albert
at Apple:
>
Actually, argument 2 should not be const, and Xcode 1.1 is
>
correct. The ISO C standard specifies that the second
>
argument to main() is a char *[], not a const char *[].
>
Using a const char *[] by default is not really ideal
>
because it implies an additional restriction on the second
>
argument that the standard doesn't require.
>
>
That leads to the second issue, which is the warning. GCC
>
is actually somewhat nice in only warning for this rather
>
than displaying an error. Converting a const char ** to a
>
char ** is illegal in C because the allowed conversion
>
from pointer-to-const-T to pointer-to-T doesn't apply
>
recursively. See
>
<http://www.eskimo.com/~scs/C-faq/q11.10.html> for
>
details.
>
>
In other words, either the template should cast or
>
NSApplicationMain should take a char *[] as its second
>
argument, but the change in Xcode's template makes the
>
template more standards-compliant. I'm not on any of the
>
teams that are involved here, but I'd vote for
>
NSApplicationMain being changed for the same reason as
>
changing main.m was the right thing to do. I think we
>
already have a bug report about that. :)
HTH - m.
--
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
AppleScript: the Definitive Guide! NOW SHIPPING...! (Finally.)
http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.