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: Nick Zitzmann <email@hidden>
- Date: Thu, 04 Oct 2012 10:06:06 -0600
On Oct 4, 2012, at 1:33 AM, Jean-Denis MUYS <email@hidden> wrote:
> On 4 oct. 2012, at 01:01, Nick Zitzmann <email@hidden>
> wrote:
>>
>> Or just add NS_BUILD_32_LIKE_64 to the preprocessor macros, which will turn NS(U)Integers into longs instead of ints when building for 32-bit, which solves the problem in a less painful way. As long as you're not using any C++ code in your project, this won't cause any problems.
>
> Nice idea. Could you elaborate on what kind of problems this could cause when using C++/Objective-C++?
If your project uses a C++ library built by someone else, and the ints your project passed into a C++ library function suddenly become longs or the other way around, then linking will fail. That's because C++'s operator overloading feature requires it to keep track of the arguments each function takes, and the linker gets confused because your code tried to pass in a long and it won't be able to find a variation of that function that took a long. C++ is much pickier about getting types right than C.
If your project doesn't use any libraries that expose C++ or ObjC++ symbols, though, then there shouldn't be a problem with using NS_BUILD_32_LIKE_64.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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