When should I use pragma pack?
I found this code on some source files while other sources do not have the pragma pack()
Code:
#pragma pack (1)
typedef struct _net_ip_header_t {
uint8 hdr_len:4; // header length
uint8 version:4; // version
uint8 tos; // type of service
uint16 tot_len; // total length
uint16 id; // identification
uint16 flags_offset; // fragment offset field
uint8 ttl; // time to live
uint8 proto; // protocol
uint16 cksum; // checksum
ip_addr src_ip; // source ip address
ip_addr dst_ip; // destination ip address
} net_ip_header_t;
#pragma pack ()