objc warning: "discard qualifiers from pointer target type"

When compiling this:

char *str = [[NSString stringWithFormat:@"%i days and %i hours", days, hours] UTF8String];

I get this warning:

initialization discards qualifiers from pointer target type

How do I get rid of it?

Answers


The qualifier you’re missing is const. -UTF8String returns a const char *, so str should also be declared const char *.


Need Your Help

Selecting random top 3 listings per shop for a range of active advertising shops

sql sql-server sql-server-2005 subquery

I’m trying to display a list of shops each with 3 random items from their shop, if they have 3 or more listings, that are actively advertising. I have 3 tables: one for the shops – “Shops”, one for...

Is there a way to secure folders in ColdFusion, without the use of Application.cfc in every folder?

coldfusion application.cfc coldfusion-7

The only way I can figure how to secure folders, is to include a basic Application.cfc in every-single-one including sub-folders.