What's the side effect of the following macro in C ? Embedded C

前端 未结 4 1090
野趣味
野趣味 2020-12-07 02:39
#define MIN(A,B) ((A) <=  (B) ? (A) : (B))

this is the macro , I was asked what\'s the side effect if I used the following :

lea         


        
4条回答
  •  余生分开走
    2020-12-07 03:07

    The macro will expand to:

    least = ((*p++)<=(b)?(*p++):(b))
    

    you will have then *p++ twice in your statement (i.e., it will be incremented twice).

提交回复
热议问题