What's the best g++ optimization level when building a debug target?

前端 未结 3 1294
Happy的楠姐
Happy的楠姐 2020-12-12 22:34

When you want to build something that\'s debuggable (g++ specifically, but perhaps shares an answer with gcc), what\'s the best -O level? In other words, when building a \"

3条回答
  •  余生分开走
    2020-12-12 23:13

    debugging mode (the -g) and optimization levels (the -O* family) are independent issues. the -g flag basically instructs gcc to include debugging symbols when compiling (and some hints corresponding to line numbers in the code). It can be applied to any optimization level.

    The simple answer, therefore, is "the best g++ optimization level when building the production program", which is a much longer discussion

提交回复
热议问题