Using and returning output in C macro

后端 未结 5 1706
说谎
说谎 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 13:05

    there is no need to declare variable if your function is returning something then you can directly get that value. For example:

    #define FOO(A) do_something(A)
    

    Here do_something returns some integer. Then you can easily use it like:

    int a = FOO(a);
    

提交回复
热议问题