Devcorner: Macros Are Evil

The joys of programming - hours spent scratching one's head whilst trying to figure out why the seemingly correct code does not produce correct results. Hi, Charlie here. I used to post often. Where was I? Ah, yes, this nugget of brain fudgery from the VDrift forums posted by NaN: So I've spent some time today try to figure out why cars are still flying off in random directions when hitting curbs sometimes. It turns out it is a bug in Bullet, to be more specific in the SIMD_DEGS_PER_RAD macro. Code: #define SIMD_PI btScalar(3.1415926535897932384626433832795029) #define SIMD_2_PI btScalar(2.0) * SIMD_PI #define SIMD_HALF_PI (SIMD_PI * btScalar(0.5)) #define SIMD_RADS_PER_DEG (SIMD_2_PI / btScalar(360.0)) #define SIMD_DEGS_PER_RAD (btScalar(360.0) / SIMD_2_PI) The first one to spot it gets a virtual cookie. For the answer visit the thr...