4

For gcc flags like --coverage, do they have any side effect, for example run time performance penalty?

If not then can I just leave them in the common makefile and use them to build production code?

Gcc document doesn't say anything about this.

This question How Does The Debugging Option -g Change the Binary Executable?

explains -g, but how about --coverage?I guess the answer is yes, the added instrument code must cost quite a bit at runtime

Community
  • 1
  • 1
swang
  • 5,157
  • 5
  • 33
  • 55

1 Answers1

1

Transferring a succinct comment as an answer so maybe there can be closure on the question.

Coverage code costs space and time. You probably don't want them in production code.

Debug information isn't loaded normally; the cost is much smaller (basically, zero).

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278