'What does #ifndef _Python_CALL mean in a C++ code?

I am debugging a C++ code which contains something related to Python. In a function:

void normalize(string &text) {

...

#ifdef _Python_CALL
    newContentStr = contentStr;
#endif
#ifndef _Python_CALL
   ...
   ...
#endif

return 0;

}

I am using GDB to keep track of the code logic, and I found that after it reaches the line:

newContentStr = contentStr;

It then directly jumps to the last line in the function:

return 0;

Why is the code between the following is skipped?

#ifndef _Python_CALL
       ...
       ...
    #endif

Also note that the first is "#ifdef" and the 2nd is "#ifndef". Does that make the skip?

c++


Solution 1:[1]

#ifndef is the opposite of #ifdef.

In your case, #ifdef is true, so it jump to return 0 directly and omit #ifndef block.

see this official doc

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 navylover