Which files are necessary to be compiled?

S

Sortie

Suppose a project that has several files and assume the
preprocessor directives are not involved in the following.

Is it always enough to compile just the .c files that have
changed since the last full compile?

In which cases this is not enough?
 
J

jameskuyper

Richard said:
Assuming that your project consists of nothing but .c files, yes,
that's sufficient. But that isn't always the case.


One obvious example - you have written a .h file, and /that's/
changed. Then, any dependencies of that .h file need to be
recompiled.

Sortie said "assume the preprocessor directives are not involved in
the following". The wording and intent of that phrase is less than
perfectly clear, but it might be taken as implying, among other
things, that any #include preprocessor directives that might be
present should be assumed to refer to files (or standard headers)
which have not changed.
 
R

Richard Bos

Eric Sosman said:
There's something wrong with a project that has "several" files
and does not at the very least use #include to compile some of those
files as parts of others. But letting that pass for now ...


Yes, assuming you've used the same compiler and the same compile-
time option flags (or equivalent) throughout.

No, since if we're doing stupid things like assuming that "the
preprocessor directives are not involved", there is nothing to stop us
from calling our source files "something.cee" instead of "something.c".

Never underestimate the perversity of the undergrad lecturer asking
imbecilic questions.

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top