Using .pch file to include applcation files

后端 未结 2 1006
礼貌的吻别
礼貌的吻别 2021-01-14 12:25

I just came to know that if we include anything in .pch file, we don\'t have to include later in other files. Now I am thinking of adding all of my files in it so that I don

相关标签:
2条回答
  • 2021-01-14 12:49

    It is definitely not a good practice, you should however definitely include the files that will be needed in all or most of the files, singletons and data models would be a good candidate for example.

    The reason why this is a bad idea is cycling references, if you were to include all your files in that .pch file you will soon get some errors about cycling references.

    0 讨论(0)
  • 2021-01-14 12:56

    "Hi Alex .. I'll take bad ideas for $1000" :D

    Aside from Oscar's answer, you will also subvert the build process. As every file knows about and hence depends on every other file, then changing a single file will mean that all compilation units in the project will be forced to be built on every recompilation - rather than just building what has changed.

    0 讨论(0)
提交回复
热议问题