
44 Chapter 4
Program 31: Very Small Numbers
This programmer was smart. He decided to use bitfields to store flags to avoid
the problems seen in Program 30. But he creates his own new set of problems:
1 /************************************************
2 * printer status -- Print the status of the *
3 * printer. *
4 ************************************************/
5 #include <iostream>
6
7/*
8 * Printer status information.
9*/
10 struct status {
11 // True if the printer is on-line
12 int on_line:1;
13
14 // Is the printer ready
15 int ready:1;
16
17 // Got paper
18 int paper_out:1;
19
20 // Waiting for manual feed paper
21 int manual_feed:1;
22 };
23
24 int main() ...