main() vs getopt() signature mismatch
main() vs getopt() signature mismatch
- Subject: main() vs getopt() signature mismatch
- From: Todd Heberlein <email@hidden>
- Date: Thu, 24 Oct 2013 17:02:16 -0700
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
_______________________________________________
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