Subject: Re: [PATCH 4/7] xdiff: make fields of xrecord_t Rust friendly

From: Collin Funk <[email-masked]>
Date: Mon, 28 Jul 2025 13:00:21 -0700

Ezekiel Newren <[email-masked]> 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 
    1

On GNU/Linux aarch64:

    $ ./a.out 
    0

Collin