Sujan Datta wrote:
>
> What are the possible effects of modifying an existing header file,
> which includes bunch of defines, function prototypes and some struct
> definitions. The structure of the header file looks something like
> [...]
> This header file is shared between multiple C files, which are
> compiled into separate executables. However, these separate
> executables run on the same machine and work in conjunction with each
> other.
> Let say one of the C file is changed along with the header file, where
> some defines and function prototypes were added in the middle of the
> file as opposed to the end of the file. After compiling the
> executable that uses the modified C file, what are the chances that
> the new executable will cause problems when ran with the executables
> compiled with older version of the h file. [...]
The programs should continue to work correctly with
each other, provided none of the data types, coded values,
and so on that they share have been changed. Adding new
types and declarations won't affect existing programs that
don't use the new stuff. Therefore, it doesn't matter where
in the header they are added.
If the header contains function and/or data definitions
as opposed to mere declarations (an uncommon practice, but
it does sometimes make sense), adding new code or new data
to the header *does* change all programs, new and old, that
use the header. Also, the position at which the new material
is added *may* make a difference.
If you're in the slightest doubt, take no chances:
recompile everything that uses the changed header.
--