Re: main() vs getopt() signature mismatch
Re: main() vs getopt() signature mismatch
- Subject: Re: main() vs getopt() signature mismatch
- From: Jean-Daniel Dupas <email@hidden>
- Date: Fri, 25 Oct 2013 08:51:10 +0200
Le 25 oct. 2013 à 02:02, Todd Heberlein <email@hidden> a écrit :
> I’ve noticed the argv variable in main() and getopt() are declared differently (the “const” is in a different place):
>
> const char * argv[]
> char * const argv[]
>
> int main(int argc, const char * argv[])
> int getopt(int argc, char * const argv[], const char *optstring)
>
> My work arounds are either to
>
> (1) cast argv in the get opt() call:
>
> while ((c = getopt(argc, (char * const *)argv, "smx")) != -1) {
> }
>
> (2) or redefine main()
>
> int main(int argc, char * const argv[])
>
>
> Any idea of the right way to deal with the argv difference in main() and getopt()?
>
> Todd
What about changing main to "int main(int argc, char *argv[])" as defined in the C standard (section 5.1.2.2.1) ?
-- Jean-Daniel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden