I’m dealing with a codebase where naming standards have been routinely ignored. So, there are methods in some classes which return objects with reference counts of 1 even though the method name does not conform to NARC. Fantastic stuff.
I’d like to convert the project to use automatic reference counting, but I’m a little nervous due to the fact that NARC naming standards have been ignored altogether. Does anyone know whether ARC relies on NARC naming standards to work properly?
Thanks,
Sean
ARC does rely on the naming conventions to work correctly. However…
If you only used ObjC objects, then it will typically “work out” as long as you only have ARC code. For example, if you had a method like:
This is wrong (in non-ARC code), but ARC will balance it out by effectively adding an extra
autorelease. In fact, the above is correct ARC code, so it’s fine.My suggestion, if this is almost all ObjC code, is to auto-convert to ARC and then run the static analyzer. The problem may actually be much smaller than you fear if it’s fairly simple code that just happens to have bad naming.
If this is heavily Core Foundation toll-free bridged code, things are a little more complicated. Then I’d recommend running the static analyzer first and getting your naming right before converting. Luckily, naming conventions is something that the static analyzer is very good at.