C Tutorial Struct bit fields
The C Language
C History
BCPL
Euclid’s Algorithm in C
Euclid on the PDP-11
Pieces of C
C Types
Declarators
Struct bit-fields

Code generated by bit fields
C Unions
Layout of Records and Unions
C Storage Classes
malloc() and free()
Dynamic Storage Allocation
Simple Dynamic Storage Allocation
malloc() and free() variants
Fragmentation
Fragmentation and Handles
Automatic Garbage Collection
Arrays
Lazy Logical Operators
The Switch Statement
setjmp/longjmp: Sloppy exceptions
Nondeterminism in C

 

 

HOME
 


 

Aggressively packs data into memory

 

struct {

 

unsigned

int

baud

:

5;

unsigned

int

div2

:

1;

 

unsigned int use_external_clock : 1;

 

} flags;

  •  Compiler will pack these fields into words. Implementation-dependent packing, ordering, etc.

  • Usually not very efficient: requires masking, shifting, and read-modify-write operations.

Contact for more learning: webmaster@freehost7com