if we have a lot of comments in our iOS app does it slow down the program or do they get stripped out during compilation ?
Asked
Active
Viewed 91 times
1
-
related: https://stackoverflow.com/questions/28950718/do-comments-get-translated-to-machine-code-c, also https://stackoverflow.com/questions/34112322/in-which-step-of-compilation-are-comments-removed – Sulthan Mar 30 '19 at 17:33
1 Answers
3
Comments are completely ignored by compilation (depending on compiler and language they are either removed completely or replaced by a single space) and won't affect your program in any way.
The same is true for most programming languages and most compilers (exceptions usually being special directives hidden inside comments).
Comments might slow down the compilation process in a very small way.
Your next question might be why replacing comments by a single space. Consider the following:
NSString *token;
NSString *to/* comment */ken;
The second one is invalid code since it will be translated to:
NSString *to ken;

Sulthan
- 128,090
- 22
- 218
- 270