• 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: NSApplicationMain const warning
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSApplicationMain const warning


  • Subject: Re: NSApplicationMain const warning
  • From: René Puls <email@hidden>
  • Date: Wed, 5 May 2004 21:43:01 +0200

Am 05.05.2004 um 20:19 schrieb Allan Odgaard:

On 5. May 2004, at 17:48, Reni Puls wrote:

So NSApplicationMain requires 'argv' to be an array of const char pointers. Why does it matter if I pass it a non-const array? It's not like I am forcing the function to modify the strings--if it wants to consider them constant, that is fine with me. Shouldn't the C compiler silently ignore this?

No it should not! :) The problem is that NSApplicationMain takes an array of constant strings, but the array itself is not const, so it could do this:
[...]

Okay, let's see if I understood this correctly: The basic problem is that NSApplicationMain, with its current declaration, could assign a char const * to one of my argvs, which it couldn't do if argv were an array of char *. (Because assigning a char const * to a char * variable would result in a warning, or perhaps even an error.)

I hadn't thought of that, but it makes sense. Thanks everyone for explaining this. Sometimes C is much more complicated than it looks. ;-)

Kind regards,
Reni Puls
_______________________________________________
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.


  • Follow-Ups:
    • Re: NSApplicationMain const warning
      • From: Robert Kuilman <email@hidden>
References: 
 >NSApplicationMain const warning (From: René Puls <email@hidden>)
 >Re: NSApplicationMain const warning (From: Allan Odgaard <email@hidden>)

  • Prev by Date: Re: Localized Embedded Frameworks
  • Next by Date: Re: Cut/Copy/Paste in NSTextField controls
  • Previous by thread: Re: NSApplicationMain const warning
  • Next by thread: Re: NSApplicationMain const warning
  • Index(es):
    • Date
    • Thread