What is the '\' operator in the C language?

前端 未结 3 1352
猫巷女王i
猫巷女王i 2020-12-11 21:37

The example that I am looking at is like this:

#define CONTROL_MEM_SIZE    ((CONTROL_ITEM_SIZE * CONTROL_QUEUE_SIZE) +   \\
                            portQ         


        
相关标签:
3条回答
  • 2020-12-11 22:27

    C11 p5.1.1.2: Translation phase 2

    Each instance of a backslash character (\) immediately followed by a new-line character is deleted, splicing physical source lines to form logical source lines. [...]

    0 讨论(0)
  • 2020-12-11 22:32

    It's not an operator, really. It's just a line extension - it tells the preprocessor that the #define replacement text continues on the next line of the file.

    Check out #3 at this link:

    Continued lines are merged into one long line. A continued line is a line which ends with a backslash, \. The backslash is removed and the following line is joined with the current one.

    0 讨论(0)
  • 2020-12-11 22:37

    The \ character at the end of a line is a line continuation.

    It tells the preprocessor to ignore the newline and consider the following line as part of this one.

    Compare to the VBScript _ line continuation character.

    0 讨论(0)
提交回复
热议问题