Our code needs to run on multiple platforms with different rules, so we follow none of them!

Raymond Chen

A customer was encountering sporadic crashes in their 64-bit application, and upon investigation, the problem was traced to a misaligned RSP register. We saw some time ago that the Windows x64 calling convention requires the RSP register to be 16-byte aligned. The customer traced the source of the misalignment to a third-party library they were using. They contacted the vendor, who acknowledged that they were not following the Windows x64 calling conventions, but explained that their code needs to run on multiple x64 operating systems, and since each operating system has different calling conventions, they adhere to none of them!

I was kind of boggled by this remark. Yes, it’s frustrating that different operating systems have different calling conventions, but that doesn’t mean that you are welcome to ignore them. Every region of the world has different laws regarding the operation of motorized vehicles, but that doesn’t mean “My truck driver has to drive through all these different jurisdictions with different rules, so he follows none of them!”

0 comments

Discussion is closed.

Feedback usabilla icon