objective c - How to remove 100s of warnings "implicit conversion loses integer precision: 'NSInteger' (aka 'long') to 'int'" I got after updating to arm64? -
problem:
yesterday converted large project of mine support arm64 , after got 500+ warnings @ once. 70% of them nsinteger
being assigned int or vice versa, , remaining nsuinteger formatted in nsstring
this:
nsinteger = 123; nsstring *str = [nsstring stringwithformat:@"int:%d", a]; //warning: value of 'nsinteger' should not used formate argument; add explicit cast 'unsigned long' instead.
now know how adress them manually, that's huge task , laborious. i'm aware can silence type mismatch warnings together, don't want that. of course, they're helpful.
what i've tried:
- i've converted
[nsnumber numberwithint:abc];
[nsnumber numberwithint:(int)abc];
using find-n-replace. fixed some. i've tried change int properties nsinteger properties doubled number of warnings (reached 900+ count). reverted.
i've tried find regular expression couldn't find suitable needs.
question:
i'm looking regular expression or other workaround has tried can reduce amount of work needed fix them manually.
thanks in advance.
nsinteger = 123; nsstring *str = [nsstring stringwithformat:@"int:%ld", (long)a];
after updating 64 bit need typecast this((long)a). %d 32 bit range %ld long integer. better understanding got through apple documentation.
Comments
Post a Comment