Lets say i am implementing a libc for amd64 linux and is using rust. what integer size should i choose for function params

every libc implementation (written in C) for amd64 linux takes in. or return an int (which is i32 in this case). though i do not mind incompatibility. i find it enticing to use isize for most functions

That depends on the purpose. If you are interfacing with a c library, use a compatible type to avoid unnecessary casts. If it represents a kind of size, length or offset, use usize. If it's a difference of those use isize. If there is an obvious valid range from the project domain (like 0 to 100), use the smallest integer that covers that. In particular, think about whether negative values ever make sense. In most other cases, I'd simply use a u64.

1 Like

Why not librust? Libc seems too old.