-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Disallow omitting the ABI in extern
declarations
#697
Conversation
The RFC should clarify whether this applies to "extern functions" ( |
I guess it is nice to be explicit about it, considering that in C declaring a function |
As per comment by @tomjakubowski
extern
blocksextern
declarations
@tomjakubowski I meant to propose the change for both functions and blocks. I tried to modify the text of the RFC to make this more clear and to explain why I think that doing it for just one of them is a bad idea. |
I still find the default fairly reasonable. |
I'm not personally much in favour of this, |
@nikomatsakis If any default should be, I agree that the current one is very reasonable. @huonw
with
The second one looks much better to me. I know that you could explicitly mention the "C" ABI specifier in such a case and omit it in other ones, but overall this would make the code less consistent. I feel like the ABI specifier makes it easier to understand what the |
I'm somewhat mystified why we use |
A concrete proposal:
semantics:
Finally, an extern block with explicit abi, and only statics inside triggers a warning. (statics don't care about abi.) |
I'm in favor of explicitness - I prefer to be explicit with ABIs in my own code anyway. |
@Ericson2314 my understanding is that linkage and ABI are already independent: the first is controlled by the Do you mean that it might be nice to separate the |
@ranma42 Interesting, I did not know about |
-1. The default "C" abi really makes sense. If someone like explicit, just |
@Ericson2314 I had misunderstood what you meant for linkage. My current understanding is that you mean that foreign functions are special and are only allowed in |
@ranma42 Ah ok. I was mistaken, the situation is less bad than I thought in that So yes, while I now see that what I am complaining about can be fixed independently from your RFC (sorry about that), the fixes complement each other. Consider this:
Semantics:
|
Also, adding an |
@brson Should we try and agree on a resolution about this in time for alpha2? This would certainly be a breaking-change (even though a minor one or at least easy to fix), so it might not be appropriate for the beta (AFAIU the language syntax should not be modified in an incompatible way after alpha). |
It's too late to make this change without breaking backwards compatibility, and support was mixed in any case, so I'm going to close this RFC. Thanks for the suggestion, @ranma42! |
Rendered view