Re: NSString into *arguments[]
Re: NSString into *arguments[]
- Subject: Re: NSString into *arguments[]
- From: John Stiles <email@hidden>
- Date: Mon, 01 May 2006 06:51:32 -0700
Kevin Bracey wrote:
thanks for your help,
Is this even possible?
but that gives me an incompatible pointer when I use it later I would
like it to be a
char *arguments[]
Well, any function which takes a non-const char* is saying "I could
modify this string"... but if it /does/ modify the string, your app may
crash (if it modifies the "quoted string") or corrupt memory (if it
modifies the [copyToPath UTF8String]).
If you have a function which takes a char* but does not modify the
string, change it to take a const char*. This shouldn't cause any problems.
If it /does/ modify the string, then you can't use that function with
these strings. It won't work properly.
Honestly I think GCC's standards enforcement is too weak here; const
violation should be a bona fide error, not a warning. (If you /must/
violate const, and you're sure it's safe, that's what casting is for.)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden