Carbon’s most exciting feature is its calling convention
1–10 of 223 posts
Re: Carbon’s most exciting feature is its calling convention
#2Re: Carbon’s most exciting feature is its calling convention
#3At first I thought this was about Mac OS around the 9 and 10 times... but I suppose not everyone is going to make that link with this name.
Re: Carbon’s most exciting feature is its calling convention
#4I think this boils down to: Carbon defaults to passing parameters that fit in a single register by value, and all others by const reference. This affects a few things you might take for granted in C++, like whether you can take a reference to a parameter.
The opening example is showing two samples of Carbon and the equivalent C++ code, noting that the "undecorated" parameter `p : Point` is equivalent to `const Point& p` (pass by const reference to a struct) and `x : i32` is equivalent to `std::int32_t x` (pass by value).
Re: Carbon’s most exciting feature is its calling convention
#5At first I thought this was about Mac OS around the 9 and 10 times... but I suppose not everyone is going to make that link with this name.
You’re certainly not the only one. It’s a confusing choice of naming.
Re: Carbon’s most exciting feature is its calling convention
#6Re: Carbon’s most exciting feature is its calling convention
#7At first I thought this was about Mac OS around the 9 and 10 times... but I suppose not everyone is going to make that link with this name.
You’re certainly not the only one. It’s a confusing choice of naming.
Re: Carbon’s most exciting feature is its calling convention
#8Re: Carbon’s most exciting feature is its calling convention
#9The reverse is true. Anything passed by value can be treated as const reference by the compiler if the compiler knows enough about access and lifetime. The compiler must be able to determine that the parameter is neither deallocated nor modified while the function is using it. Rust compilers should be able to do that.
Re: Carbon’s most exciting feature is its calling convention
#10At first I thought this was about Mac OS around the 9 and 10 times... but I suppose not everyone is going to make that link with this name.