Using and returning output in C macro

后端 未结 5 1753
说谎
说谎 2021-02-02 12:33

I\'m trying to instrument some code to catch and print error messages. Currently I\'m using a macro somethng like this:

#define my_function(x) \\
  switch(functi         


        
5条回答
  •  渐次进展
    2021-02-02 12:58

    This is relatively complicated code, there is not much reason to have it in a macro. Make it inline (C99) or static (C89) or both if you really want to place it in a header file. With any reasonable compiler this then should result in the same efficiency as a macro.

提交回复
热议问题