Verify how to represent arrays in function signatures

Open
#5,536 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
c, rust

Research direction

Start by reviewing the socketpair binding and the ctest behavior for function signatures. Determine which C array parameters can safely use fixed-size array pointers without changing valid ABI cases, then define representative checks for the accepted pattern. Done means the approach is decided and ctest expectations cover the supported cases.

Written by the indexing model from the issue text.

Description

ctest

E.g. socketpair is:

int socketpair(int domain, int type, int protocol, int sv[2]);

But we have

pub fn socketpair(domain: c_int, type_: c_int, protocol: c_int, socket_vector: *mut c_int) -> c_int;

*mut [c_int; 2] is ABI-compatible and more user-friendly, so we should consider using it and possibly updating ctest to require this kind of thing.

We may not be able to do this in general because technically in C, you can pass more than 2 items. But for most cases this shouldn't be a problem.

Dominant language
Rust
Stars
2.6k
Forks
1.3k
Avg merge
2d 13h
Merged PRs (30d)
27

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-lang/libc

All issues in rust-lang/libc

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.