3 ms·
One place you can come across them is in IP header processing. Very first byte of an IPv4 header is defined as: struct ip { #if BYTE_ORDER == LITTLE_ENDIA
by jandrese 9y ago
One place you can come across them is in IP header processing. Very first byte of an IPv4 header is defined as:
struct ip {
#if BYTE_ORDER == LITTLE_ENDIAN
u_char ip_hl:4, /* header length */
ip_v:4; /* version */
#endif
#if BYTE_ORDER == BIG_ENDIAN
u_char ip_v:4, /* version */
ip_hl:4; /* header length */
#endif
As you can already see, they're kind of a pain to work with, so most people avoid them when possible.