Get the App
SLTechnology News&Howtos  ›  Development  › 

C++ Code compilation and sentence sequence Analysis with examples

Shulou Source: shulou.com Published: 2022-06-02 09:42:36 09月29日 Update

This article mainly explains "C++ code compilation and sentence sequence example analysis". The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Now please follow the editor's train of thought slowly and deeply. Let's study and learn "C++ code compilation and sentence sequence example analysis"!

Debug tags are suitable for preprocessing # define to define one or more debug tokens, and the debug part is managed using # ifdef and # endif in the code. When the program is finally debugged, you only need to use the # undef tag, and the debug code will disappear. Commonly used debugging is marked as DEBUG, C++ code statement sequence:

# include

< assert>

Using namsapce std; int main () {int iTunes 100; assert (iTunes 100); / / Fails} when debugging is finished, add # define NDEBUG before # include to eliminate the code generated by red}

The debug token at run time turns on and off the debug token while the program is running. This can be achieved by setting a debug bool tag. This is more convenient for programs run on the command line.

For example, the following C++ code:

# define DEBUG # ifdef DEBUG

The macro is in, when using assert, give him an argument, that is, an expression that is interpreted as true. The preprocessor generates code to test the assertion, and if the assertion is not true, it sends an error message telling what the assertion is and fails for a while, and the program terminates.

# include # include using namespace std; bool debug = false; int main (int argc,char*argv []) {for (int iTunes)

Tags: Code tags clocked codes sequences statements programming analysis programs learning running content preprocessing information parameters commands multiple that is commonly used ideas situations Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Huawei macOS Xiaomi Shulou Information