Why do multi-line macros have backslashes at the end of each line?

后端 未结 4 1506

In a macro declaration like:

#define WAIT_SPI2_TRANSMISSON_END() {while ((SPI2_SR & SPI_SR_TXCTR_MASK) != 0) {\\
                                     if(         


        
4条回答
  •  梦谈多话
    2020-12-31 05:26

    It is so called continued line. It means that your line is continued in line that follows. It is simply sometimes easier to read stuff if written this way.

    BTW - continued lines are 'glued' at preprocessor pass.

    Read here about step #3: gcc docs

    Excerpt:

     /\
     *
     */ # /*
     */ defi\
     ne FO\
     O 10\
     20
    

    is equivalent to:

    #define FOO 1020
    

    It is noteworthy to say that continued lines do not have to be used within preprocessor macros. It is perfectly legal top write this:

    f\
    lo\
    at f = 5.0; 
    

    which is the same as:

    float f = 5.0;
    

提交回复
热议问题