On Tuesday, 14 September 2021 at 14:56:00 UTC, jfondren wrote:
You could fix this by having a 128-bit struct and passing C an index into it

It is another "not so funny joke", isn't it?
Look

```c
    typedef union epoll_data {
        void *ptr;
        int fd;
        uint32_t u32;
        uint64_t u64;
    } epoll_data_t;

    struct epoll_event {
        uint32_t events;      /* Epoll events */
        epoll_data_t data;    /* User data variable */
    } __EPOLL_PACKED;

   // inside the system
   struct epoll_event {
         __u32 events;
         __u64 data;
   } EPOLL_PACKED;
```

and notice

```d
align (1) struct EpollEvent {
    align(1):
    uint event_mask;
    EventSource es;
    /* just do not want to use that union, epoll_data_t */
}
static assert(EpollEvent.sizeof == 12);
```

Reply via email to