Hi Elliott, H.J., On Thu, Aug 22, 2024 at 02:05:33PM GMT, enh wrote: > On Thu, Aug 22, 2024 at 1:34 PM enh <enh@xxxxxxxxxx> wrote: > > > Redefinition of transparent unions is allowed? I'm not sure; at least > > > prior to C23. > > > > huh. i did not know that. "works for me" on clang, anyway, and seems > > like a good argument for the transparent union... > > > > i took a more careful look at the code i can easily search, and i found: > > > > 1. extern int arch_prctl(int, unsigned long); > > the most common choice, presumably popularized by the kernel source > > and the man page. > > 2. extern int arch_prctl(int, uintptr_t); > > much less common, and compatible with option 1 anyway. > > 3. extern int arch_prctl(int, unsigned long*); > > very rare, but used in compiler-rt for tsan (and at least a gcc > > hwasan tests?). > > 4. extern int arch_prctl(int, unsigned long int); > > if you're not into the whole brevity thing. > > > > so actually the transparent union is the only thing that's source > > compatible with all the existing code [in the corpus i have easy > > access to]. Good. :) > ...except transparent unions are C-only, so we'd need something else > for C++ if we went with this for C. Why don't they have transparent unions in C++? Is it just that nobody cared to implement them? Or do they have inherent problems there? Anyway, a C++ project can probably compile a few objects as C files to workaround that. Cheers, Alex -- <https://www.alejandro-colomar.es/>
Attachment:
signature.asc
Description: PGP signature