[PATCH v4] ungetc: Guarantee single char pushback

Siddhesh Poyarekar siddhesh@sourceware.org
Wed Dec 11 13:15:46 GMT 2024


On 2024-12-10 09:03, Richard Henderson wrote:
> On 12/10/24 06:30, Siddhesh Poyarekar wrote:
>> -  int _flags2;
>> +  int _flags2:24;
>> +  char _short_backupbuf[1];
> 
> This doesn't create a 3-byte flags2, if that's what you're trying.
> The underlying storage will still be int-sized, now with 8 unallocated 
> bits.

gcc and clang both appear to pack in the struct just fine, which 
effectively gives flags2 3-bytes storage and _short_backupbuf right next 
to it.  Maybe I've misunderstood the issue you're trying to point out, 
could you please elaborate?

Thanks,
Sid


More information about the Libc-alpha mailing list