Design Notes
These design notes may be useful to people interested in the source
code.
- Default bytes per line and lines per page are
stored as constants so they may be changed more easily
- Most of the program code is contained within
the HexDump () function, leaving only the command-line argument parsing
to the main () function. This makes the program easier to be re-used in
another program
- The code that provides the editor feature is
only compiled when the pre-processor definition INCLUDE_EDITOR is
defined. This makes it possible to compile a smaller version of the
program that doesn’t include the editor. On my compiler, the executable
without editing support is 172 KB and with editing support is 176 KB
(this is using the static run-time library with debug information
included). 4 KB is not much, but this demonstrates conditional
compilation
- The stdafx.h file is included in place of
stdio.h, stdlib.h and string.h. Stdafx.h is a file that Visual C++ (the
compiler I use at home) sets up automatically when creating a new
program with the recommendation that other header files are included
there. I am assuming this is to speed up compilation as the headers are
only compiled once and simply re-linked each time the program code
changes.
- Stdafx.h can be replaced by stdio.h, stdlib.h
and string.h and the program should still run (although a few changes to
project settings may be required)
- When displaying a file, offsets are shown in hexadecimal by default,
but this can be changed to decimal using a command line argument
|