Strange behaviour of macros C/C++

前端 未结 5 599
再見小時候
再見小時候 2020-12-04 03:02

I\'m using some macros, and observing some strange behaviour.

I\'ve defined PI as a constant, and then used it in macros to convert degrees to radians and radians to

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-04 03:20

    You should use parenthesis for your macros to specify precedence. In addition to that, i think in many cases math.h will define PI for you

提交回复
热议问题