Skip to content
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" { ... } be disallowed? #422

Closed
alexcrichton opened this issue Jul 8, 2018 · 2 comments
Closed

Should extern "C" { ... } be disallowed? #422

alexcrichton opened this issue Jul 8, 2018 · 2 comments
Labels

Comments

@alexcrichton
Copy link
Contributor

I've noticed in a few locations that we're annotating APIs with:

#[wasm_bindgen]
extern "C" {
     // ...
}

but under the hood there's not actually any semblance of "C"! In fact, it's somewhat more accurate to say something like:

#[wasm_bindgen]
extern "wasm-bindgen" {
    // ...
}

but that's a bit wordy and we shouldn't require that. Should we specifically deny extern "C"?

@ohanar
Copy link
Member

ohanar commented Jul 8, 2018

The main thing that I don't really like about this is that the default rustfmt configuration wants an explicit abi (and presumably the style guide will have the same suggestion). You can stop rustfmt from auto-inserting "C"s by adding a custom configuration, but we would be asking that for any project that is using custom bindings and rustfmt.

@alexcrichton
Copy link
Contributor Author

Hm I guess that answers the question for us, alas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants