I have noticed that many famous libraries written in Objective-C (eg. AFNetworking) use the macro guard inside their header files. Im aware that the #import directive, which works exactly like #include, includes each file only once, obviating the need for #include guards. For what reason are still used?

1 Answer 1


Because the solution that is already there works 100%, and changing it would require effort and bear a (slight) risk of accidentally introducing defects.

Generally, replacing deprecated constructs with more modern constructs is unpopular with users, and most never do it until you force them by removing the deprecated construct. And from a business perspective they are completely right: modernizing code costs money and yields absolutely no benefit to them, so why do it? The only one profiting from it is the platform vendor, because they can make their compiler simpler, and most application programmers don't care that much about the well-being of their tool vendor.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.