• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: main() vs getopt() signature mismatch
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: main() vs getopt() signature mismatch


  • Subject: Re: main() vs getopt() signature mismatch
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Sat, 26 Oct 2013 00:48:17 +0200

Le 25 oct. 2013 à 18:54, Todd Heberlein <email@hidden> a écrit :

>
> On Oct 24, 2013, at 11:51 PM, Jean-Daniel Dupas <email@hidden> wrote:
>
>> What about changing main to "int main(int argc, char *argv[])" as defined in the C standard (section 5.1.2.2.1) ?
>
> Interesting. When creating a new command line tool in Xcode, main.cpp begins
>
> int main(int argc, const char * argv[])
>
> I looked around to see if C++11 changed this, but I haven’t found anything yet. I wonder why Apple adds the “const” if it isn’t part of the standard?
>

C++ standard defines it in section 3.6.1 ( 3.6 Start and termination [basic.start] / 3.6.1 Main function )

It tells the "main" type is implementation defined but that

“All implementations shall allow both

— a function of () returning int and
— a function of (int, pointer to pointer to char) returning int”


-- 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


References: 
 >main() vs getopt() signature mismatch (From: Todd Heberlein <email@hidden>)
 >Re: main() vs getopt() signature mismatch (From: Jean-Daniel Dupas <email@hidden>)
 >Re: main() vs getopt() signature mismatch (From: Todd Heberlein <email@hidden>)

  • Prev by Date: Re: Any easy way to group translation units?
  • Next by Date: Re: Where are my man pages?
  • Previous by thread: Re: main() vs getopt() signature mismatch
  • Next by thread: Where are my man pages?
  • Index(es):
    • Date
    • Thread