-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Abolish callconv
, implement its functionality across extern
#7365
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
Comments
This conflicts with the awesome #5269 proposal.
So
This syntax is already taken to specify what library the |
I agree with LemonBoy that #5269 is the better propsal here. It removes a ambiguity of the keyword |
This is not possible -- I suppose this proposal leans into the multiplicity of |
That was just an example, here's an amended one: extern const foo;
const bar = extern fn (...)
The ambiguity is still there, the first
Have a look in the tracker, there are a few proposals for this. |
Yeah, this is a horrible idea. |
Uh oh!
There was an error while loading. Please reload this page.
Complement to #6057, in some ways.
With #1717,
extern const foo = fn ...
will be distinct fromconst foo = extern fn ...
. This provides us a marvelous opportunity to unify aspects ofextern
.I propose that
extern
on the left will mean the function is externally defined, whereasextern
on the right will fit with its meaning when used on other types (union
,enum
,struct
): it sets the ABI of the function. To have parity with currentcallconv
features, we would also need to allow ABI specification on the right:const foo = extern "eabi" fn ...
; we may do this without syntactic ambiguity, as the second argument must begin withfn
,union
,enum
, orstruct
, and the first may not. Note that twoextern
s will never appear on the same line, as leftextern
precludes a definition.As for compiler-internal CCs:
.Zig
-- no annotation necessary, as it is the default..Async
-- explicitly marking functions asasync
was previously possible and then explicitly rejected. Switching between synchronous and asynchronous based on argument is also a bad idea, for the same reason: the compiler should work that out..C
-- default ofextern
, also possible withextern "c"
..Naked
-- grrr. This is annoying. Personally, given the vast functional and safety difference of naked and non-naked code, I think a keyword is the best option, like the oldnakedcc
(personally I'd prefernaked
, but that's opinion).The text was updated successfully, but these errors were encountered: