This program is a filter which takes C source code and replaces
occurrences of the type specifier `int' by the identifier
`INT_BIG'. This identifier can then be assigned a preprocessor
value of a suitable integral type (int or long) either using an
include file or with a -DINT_BIG=(type) flag on the C compiler
It's not quite as simple as replacing every semantically significant
occurrence of the `int' identifier; `short int' and `long int' type
specifiers will be left alone.
If a use of int appears to be declaring a symbol called `main' or
`argc', then this will be left alone too, and a warning written
to standard error to the effect that it is not being changed.
Additionally, references to the <limits.h> macros INT_MAX, INT_MIN
and UINT_MAX are replaced by INT_BIG_MAX, INT_BIG_MIN and
UINT_BIG_MAX respectively. If any of these substitutions are
made, then a line `#include "extreme.h"' is added after the
`#include <limits.h>' line which is presumably in the file.
If <limits.h> is not included in the input file, a warning is
written to standard error.
Explicit declarations which are implicitly of type int will have
an INT_BIG token inserted - for instance `static x, y;' will be
changed to `static INT_BIG x, y;'.
The program will write a warning on standard error for certain
constructions in the code which are likely to cause trouble after
the mass redeclaration of int as INT_BIG has occurred, since in
some places the type int, and not INT_BIG, is still required.
These constructions are:
- Inclusion of system header files other than those of the C
standard library, since these may indicate use of functions
other than those warned about above with arguments of type
pointer to int.
- Use of functions from the C standard library which may require
The functions from the C standard library which may require changes
are the following:
- Format strings in formatted I/O which may need changes
because they use variable argument lists or require
arguments of type pointer to int.
- The frexp() math function whose second argument must be
a pointer to int
- The signal() function whose second argument is a function
which must take an int argument
- The bsearch() and qsort() functions which take a comparison
function as argument, and this function must be of type int
In the case of potentially dangerous format strings, for
convenience a comment is inserted in the output code on the line
before the function call is made. The comment will contain the
character string `crepint: '. The warning to standard error
notes that the comment line has been inserted.
The following constructions are also likely to cause trouble, but
will not be warned about by the program:
- Use of functions without prototypes. If header files are
omitted or old style function declarations are used then the
ANSI C machinery for doing type conversion at function call
time will not work. Gcc's `-Wstrict-prototypes' and
`-Wimplicit-function-declaration' flags are useful for this.
- Implicit declarations, which are implicitly of type int.
If a name is declared simply by mentioning it without any type
or type qualifiers, it is implicitly of type int, and so
should become delcared as INT_BIG. This program does not
find these. Such implicit declarations (only?) occur in
function declarations. The Tru64 Unix C compiler's `-protois'
flag or gcc's `-Wimplicit-int' flag are useful for identifying
The program tries to adjust padding whitespace outside comments
so that the spacing of the output looks OK.
No changes are made to comment lines so that, for instance, the
Synopsis stanza of function prologues will not have formal argument
types changed from `int' to `INT_BIG'.
Source code which makes sufficiently inventive use of the C
will stand a good chance of confusing this program.