Re: 4.5 and NSInteger/NSUInteger Format Specifier Warnings
Re: 4.5 and NSInteger/NSUInteger Format Specifier Warnings
- Subject: Re: 4.5 and NSInteger/NSUInteger Format Specifier Warnings
- From: Keary Suska <email@hidden>
- Date: Wed, 03 Oct 2012 12:16:07 -0600
On Oct 3, 2012, at 11:57 AM, Tom Seddon wrote:
> `%u' or `%lu' would be more appropriate for an unsigned value.
>
> This sort of warning IS difficult to fix reliably for mixed 32-/64-bit code, though. I don't know if there's an approved solution, but I never found any obvious fix other than the cast. So I've just stopped using the NS types wherever possible...
I should correct this, as I inadvertently copied warnings from different lines. The issue isn't signedness, but long vs short. The issue is that if the warning is about the format specifier being long, but the value being short, changing the format specifier to short simply causes Xcode to complain that the specifier is short but the value is long!
I thought that the whole point of using the NS-types was that the compiler would simply make the "right" choice as to length based on the architecture?
> On 3 Oct 2012, at 18:49, Keary Suska wrote:
>
>> Is anyone else seeing this? I get tons of warnings such as:
>> Format specifies type 'long' but the argument has type 'NSUInteger' (aka 'unsigned int')
>> when using %ld as a format specifier. If, however, I change the format specifier to %d as the warning (and the fix-it) would suggest, it changes the warning to:
>> Format specifies type 'int' but the argument has type 'long'
>>
>> Augh!
>>
>> Casting the value seems to work, but there are a hundred and fifty of them. Is there perhaps a build setting I need to change?
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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