Trace messages with the C runtime

Often you will want to test your code by running the application in real time and output the trace messages to test that your algorithms work. Sometimes you will want to test the order that functions are called (for example, that correct branching occurs in a switch statement or in an if statement), and in other cases you'll want to test intermediate values to see that the input data is correct and the calculations on that data are correct.

Trace messages can produce a lot of data, so it is unwise to send these to the console. It is extremely important that trace messages are only produced in debug builds. If you leave trace messages in product code, it could seriously impact the performance of your application ...

Get Beginning C++ Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.