Skip to content

Instantly share code, notes, and snippets.

@daparic
Created May 16, 2023 19:37
Show Gist options
  • Save daparic/6ccf3cfeb792cf4d9af04e70f817c416 to your computer and use it in GitHub Desktop.
Save daparic/6ccf3cfeb792cf4d9af04e70f817c416 to your computer and use it in GitHub Desktop.

Reference

Visual Studio C++

#pragma pack(push, 1)
struct dog {
    int n;
    unsigned char buf[3];
};
#pragma pack(pop)

Linux GCC

struct __attribute__((__packed__)) dog {
    int n;
    unsigned char buf[3];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment