How to define macro function which support no input parameter and support also input parametr in the same time

前端 未结 4 1757
不知归路
不知归路 2021-01-15 22:12

I want to define a macro function which support at the same time:

1) No input parameter

2) Input parameters

some thing like that:

#de         


        
4条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-15 22:41

    The C99 standard says,

    An identifier currently defined as an object-like macro shall not be redefined by another #define reprocessing directive unless the second definition is an object-like macro definition and the two replacement lists are identical. Likewise, an identifier currently defined as a function-like macro shall not be redefined by another #define preprocessing directive unless the second definition is a function-like macro definition that has the same number and spelling of parameters, and the two replacement lists are identical.

    I think compiler prompts a warning of redefined MACRO. Hence it is not possible.

提交回复
热议问题