9

I saw in several places that Microsoft calling conventions for x64 platforms were narrowed down to just one: Caller cleans stack (cdecl), and parameters are passed in a combination of stack and registers (I am not going into the exact details here). I assume that if this is the calling convention of the OS, then probably all other compilers targeting Windows (e.g. mingw-w64) follow it, too.

Is this calling convention true also on other major platforms (x64 Linux, etc.)? Or does Linux still use multiple calling conventions, or even just one but a different one? Do GCC or Clang allow for multiple calling conventions on x64 Linux?

Baruch
  • 20,590
  • 28
  • 126
  • 201
  • 10
    Those happy days are about to end. Microsoft is adding the __vectorcall calling convention. Up to six `__m128` values passed through SSE2 registers. – Hans Passant Aug 08 '13 at 21:06

1 Answers1

13

I just found the answer here and here. Basically, Windows does it one way, everyone else does it another way, but each platform only does it one way (as opposed to multiple ways per-platform with x86)

Community
  • 1
  • 1
Baruch
  • 20,590
  • 28
  • 126
  • 201
  • 5
    Not pointing a finger at either side, but you'd think that after all the pain x86 calling conventions have caused, agreeing on a standard would've been a priority with x64 – Basic Nov 02 '15 at 20:50