Re: [PATCH 4/7] xdiff: make fields of xrecord_t Rust friendly
- From
Collin Funk <collin.funk1@gmail.com>
- Date
- Jul 28, 2025, 20:00 UTC
- Message-ID
- <87ecu0nl0q.fsf@gmail.com>
- In-Reply-To
- <CAH=ZcbCnEpBokM9rxmmkeM9GT948n7+RipXODHLfPssuwJuVCw@mail.gmail.com>
Ezekiel Newren <ezekielnewren@gmail.com> writes:
> Rust defines char as 32 bits. C treats char as signed 8 bits. What git > really means by char* is treat everything like a byte string, and u8 > is how raw bytes are handled in Rust.
Minor correction, but the C standard leaves the signedness of 'char' up to the implementation. Portable code must be written to assume a plain 'char' can be signed or unsigned.
Using the test program below:
#include <stdio.h>
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
int
main (void)
{
printf ("%d\n", TYPE_SIGNED (char));
return 0;
}On GNU/Linux x86_64:
$ ./a.out
1On GNU/Linux aarch64:
$ ./a.out
0Collin