Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Cast to %ld and %lu instead of issuing %zd and %tu specifiers for NSInteger and NSUInteger variables #90

Closed
rsanchezsaez opened this issue Mar 30, 2018 · 2 comments

Comments

@rsanchezsaez
Copy link

rsanchezsaez commented Mar 30, 2018

Xcode 9.3 is not happy when you use %zd and %tu as a specifier for NSInteger and NSUInteger variables. They will generate warnings either when compiling on an iPhone 5c, or when compiling on an iPhone 5s+ (compile to Generic iOS device to test it):

Enum values with underlying type 'NSInteger' should not be used as format arguments; add an explicit cast to 'long' instead

This sucks if you have a project treating warnings as errors.

I suggest changing the implementation to the recommended Xcode fix-it solution: explicitly cast to (long) or (unsigned long) and use the %ld/%lu specifiers.

@rsanchezsaez rsanchezsaez changed the title Cast to %ld/%ud instead of issuing %zd/%tu specifiers for NSInteger/NSUInteger variables Cast to %ld and %ud instead of issuing %zd and %tu specifiers for NSInteger and NSUInteger variables Mar 30, 2018
@rsanchezsaez rsanchezsaez changed the title Cast to %ld and %ud instead of issuing %zd and %tu specifiers for NSInteger and NSUInteger variables Cast to %ld and %lu instead of issuing %zd and %tu specifiers for NSInteger and NSUInteger variables Apr 3, 2018
@calimarkus
Copy link
Contributor

calimarkus commented Apr 4, 2018

On the current master your generated files should not contain that anymore.
It was fixed on Feb 5 in c1e9323.

@rsanchezsaez
Copy link
Author

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants