Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upDisallow omitting the ABI in `extern` declarations #697
Conversation
This comment has been minimized.
This comment has been minimized.
|
The RFC should clarify whether this applies to "extern functions" ( |
This comment has been minimized.
This comment has been minimized.
comex
commented
Jan 22, 2015
|
I guess it is nice to be explicit about it, considering that in C declaring a function |
ranma42
changed the title
Disallow omitting the ABI in `extern` blocks
Disallow omitting the ABI in `extern` declarations
Jan 22, 2015
This comment has been minimized.
This comment has been minimized.
|
@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. |
This comment has been minimized.
This comment has been minimized.
|
I still find the default fairly reasonable. |
This comment has been minimized.
This comment has been minimized.
|
I'm not personally much in favour of this, |
This comment has been minimized.
This comment has been minimized.
|
@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 |
This comment has been minimized.
This comment has been minimized.
|
I'm somewhat mystified why we use |
This comment has been minimized.
This comment has been minimized.
|
A concrete proposal:
semantics:
Finally, an extern block with explicit abi, and only statics inside triggers a warning. (statics don't care about abi.) |
This comment has been minimized.
This comment has been minimized.
|
I'm in favor of explicitness - I prefer to be explicit with ABIs in my own code anyway. |
This comment has been minimized.
This comment has been minimized.
|
@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 |
This comment has been minimized.
This comment has been minimized.
|
@ranma42 Interesting, I did not know about |
This comment has been minimized.
This comment has been minimized.
|
-1. The default "C" abi really makes sense. If someone like explicit, just |
This comment has been minimized.
This comment has been minimized.
|
@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 |
This comment has been minimized.
This comment has been minimized.
|
@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:
|
This comment has been minimized.
This comment has been minimized.
|
Also, adding an |
brson
self-assigned this
Jan 29, 2015
This comment has been minimized.
This comment has been minimized.
|
@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). |
This comment has been minimized.
This comment has been minimized.
ms-ati
commented
May 15, 2015
aturon
added
the
T-lang
label
Jun 1, 2015
This comment has been minimized.
This comment has been minimized.
|
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! |
ranma42 commentedJan 21, 2015
Rendered view