-
Notifications
You must be signed in to change notification settings - Fork 56
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
Should extern "C" include "C" #52
Comments
I use |
I was told in review once that |
+1 for the abbreviated version. We should either use it or deprecate it, and I've seen no signs of a plan to deprecate. |
There's been a very high bar for this, generally, so even if it were disapproved of, it would be unlikely to be deprecated. |
Good point. I guess I actually mean I haven't encountered disapproval of it before. Although, if we decided to go the explicit route here, that suggests a value judgement that |
I'd prefer |
I always use |
I have the strong opinion that we should be explicit here. Because:
extern "C" {
fn foo();
} This (most likely) indicates that pub extern "C" fn bar() { .. } This (most likely) indicates that extern "Rust" {
fn main();
} Whereas, this indicates that
For example, the Rust port of compiler-rt, the compiler-builtins crate, has to use the "aapcs" ABI for the aeabi intrinsics because that's the calling convention that LLVM uses. Every other symbol has to use the "C" ABI. pub extern "aapcs" fn __aeabi_memcpy(..) { .. }
pub extern "C" fn __floatundidf(..) { .. } Getting the ABI wrong, e.g. using just
I agree 100%. |
I would like to move to FCP here with an inclination towards being explicit. I think @japaric makes a great case above and we need to choose one way or the other. |
I am also convinced by @japaric's arguments.
If this is really so dangerous, we should not just stop using |
Seems we have consensus and no further comments |
So do I get this right? Rust will go the more expressiv way with |
We've changed our process: rather than requiring a full RFC, a PR to close this issue only requires making the changes discussed here to the style guide. You can see more details about the process in the readme for this repo. If you'd like to help with this work, let me know, I'd be very happy to help you help us. |
…umeGomez rustdoc: Display `extern "C" fn` instead of `extern fn` It was decided in rust-lang/style-team#52 to be explicit about the ABI so rustdoc should follow suit.
…umeGomez rustdoc: Display `extern "C" fn` instead of `extern fn` It was decided in rust-lang/style-team#52 to be explicit about the ABI so rustdoc should follow suit.
…umeGomez rustdoc: Display `extern "C" fn` instead of `extern fn` It was decided in rust-lang/style-team#52 to be explicit about the ABI so rustdoc should follow suit.
I.e., should we format
extern "C" fn
as that orextern fn
?Previous discussion: rust-lang/rustfmt#451
The text was updated successfully, but these errors were encountered: