-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extern fn type declarations and extern fn bindings should both default to the same ABI. #9309
Comments
Nominating back compat. |
accepted backwards-compatible |
Relates to #2202. |
extern fn foo() {
// do Rust things
} seems to have the C ABI by default too. |
Is there still even an |
Yes, I believe |
looking at this |
The question is, if they should both default to the same ABI - which ABI? C or Rust? |
Niko explained via irc that his comment implies that all uses of (unadorned) |
As I commented on #12328, why is this? Wouldn't it make more sense to have |
@bjz |
Doesn't |
I just don't see that promoting |
|
Can't we just say that all |
I think this is definitely a thing that links into our 'design philosophy'. Do we privilege C as the default for all ffi stuff? If so, we need to be consistent everywhere. |
Another option would be to remove |
@bjz Rust tries to have identifiers always follow keywords. That makes things much easier to parse both by tools and humans, so I would be against We could always require an ABI for consistency, but given the target for Rust is systems programming I expect C to be the target lang for ffi in a large majority of cases. Therefore, I see nothing wrong with privileging it. It doesn't make calling any other language any harder. |
@bjz, there's some empirical evidence that C is the default: $ git grep 'extern *\("C"\)\? *{' | wc -l # extern { ... }, or extern "C" { ... }
221
$ git grep 'extern *".*" *{' | grep -v "C" | wc -l # extern "non-C abi" { ... }
34 (running in the rust root dir.) |
On Sun, Feb 23, 2014 at 05:22:08PM -0800, Brendan Zabarauskas wrote:
As for why one ought to use "C" by default, I think C does occupy a |
This has confused me several times:
The text was updated successfully, but these errors were encountered: