
3.7 Design Example: Data Compressor 145
If, on the other hand, we did not care about the ability to run multiple com-
pressions simultaneously, we can make the functions a little more readable by using
global variables for the class variables:
static data_buffer buffer;
static int current_bit;
static sym_table table;
We have used the C static declaration to ensure that these globals are not defined
outside the file in which they are defined; this gives us a little added modularity. We
would, of course, have to update the specification so that it makes clear that only
one compressor object can be running at a time. The functions that implement the
methods