Make extern ABI explicit

I think that although the ā€œCā€ ABI is certainly the most widely used for FFI, forcing it to be explicit would be better than having an implicit default. I can see that the current policy allows 4 keystrokes (counting the space) to be saved, but to me that looks pretty minor, especially given that an extern block can contain multiple function declarations.

The advantages I see in always keeping it explicit are:

  • it would ensure a more uniform coding style (even in the main rust repo you can find both extern fn and extern "C" fn)
  • it would make it easier to search for what ABIs are used in a codebase
  • it would be more familiar to C++ programmers

I found no previous thread about this, but pointers to dicussions/RFCs/ā€¦ are welcome.

1 Like

I wrote the RFC: https://github.com/rust-lang/rfcs/pull/697

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.