www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22315] New: ImportC: #pragma pack is not implemented

https://issues.dlang.org/show_bug.cgi?id=22315

          Issue ID: 22315
           Summary: ImportC: #pragma pack is not implemented
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dave287091 gmail.com

I believe Walter has said that he doesn’t intend to support #pragma pack, but
I
have discovered some macOS system headers that use the feature. At least,
fcntl.h and sys/event.h use the feature in defining some structures.

An example from event.h:

#pragma pack(4)

struct kevent {
        uintptr_t       ident;  /* identifier for this event */
        int16_t         filter; /* filter for event */
        uint16_t        flags;  /* general flags */
        uint32_t        fflags; /* filter-specific flags */
        intptr_t        data;   /* filter-specific data */
        void            *udata; /* opaque user data identifier */
};

#pragma pack()

(I have no idea why pragma pack is even used here, the structure has no
padding).
I haven’t studied the headers closely enough to see if ignoring it matters or
not.

--
Sep 18