3 ms·
So answering questions like "is this an array" is as simple as reading the C code to determine that. If only. Here's the original function definition: voi
by Animats 8y ago
So answering questions like "is this an array" is as simple as reading the C code to determine that.
If only. Here's the original function definition:
void insertion_sort(int const n, int * const p)
"p" is really an array. But C doesn't know that. Rust needs to know.
Around 2010, I proposed an extension to C [1] in which you'd write that as
void insertion_sort (int const n, int& p[n])
Instead of a pointer, you'd use a reference to an array. Same calling sequence - the compiler passes a pointer. But with enough info that the callee knows the array size. Rust needs that info to do its job. Somehow, you have to get that info into a C to Rust translator.
[1] http://www.animats.com/papers/languages/safearraysforc43.pdf http://www.animats.com/papers/languages/safearraysforc43.pdf
- staticassertion 8y agoIt is as simple as the C code, whether that is simple or not.