• ImplyingImplications@lemmy.ca
    link
    fedilink
    arrow-up
    15
    ·
    edit-2
    11 months ago

    __ LINE __ is a preprocessor macro. It will be replaced with the line number it is written on when the code is compiled. Macros aren’t processed when debugging. So the code will be skipped during debug but appear in the compiled program, meaning the program will work fine during debug but occasionally not work after compile.

    “__ LINE __ % 10” returns 0 if the line number is divisible by 10 and non-zero if not. 0 is considered false and non-zero is considered true.

    #define is also macro. In this case, it will replace all instances of “true” with something that will only sometimes evaluate to true when the program is compiled.