From: Ezekiel Newren Date: Wed, 22 Oct 2025 21:51:14 GMT Subject: Re: [PATCH 1/9] xdiff: use ssize_t for dstart/dend, make them last in xdfile_t Message-ID: In-Reply-To: On Wed, Oct 22, 2025 at 3:38 PM Junio C Hamano wrote: > > Ezekiel Newren writes: > > > In my compat/rust_types.h file (which was dropped) I defined isize > > using ptrdiff_t rather than ssize_t. Maybe that file should be revived > > so that we don't have confusion in code reviews when structs are being > > expressly converted for the purpose of Rust FFI? I'd really like to > > bring that file back so that everyone has a clear reference for how C > > types map to Rust, but no one seemed to like it except me. Maybe it > > should be an adoc file rather than a header? > > I may be mistaken, but I thought that the latest agreement was to > use conceptually the "same" type in each language, have each > language call that type in its native way, and if needed convert at > the FFI boundary. So if we agree to use, for example, 64-bit signed > integer type for counting things plus returning error conditions via > negative values, maybe C-side can agree to use i64 for it, without > having to worry about how that thing is called in Rust side. Your understanding is correct. Would Documentation/unambiguous_types.adoc be an appropriate place for this documentation? > I am not sure in what way should be used, and > perhaps a documentation file may be sufficient as you suggest, but > in any case, I agree that it should be made clear to everybody what > C-types are to be mapped to what Rust types and vice versa, and if > some C-types have no corresponding Rust type in that mapping, or if > some Rust types have no corresponding C-type, that type needs to be > converted before they reach the FFI boundary. Alright. I guess I'll drop the idea of compat/rust_types.h permanently.