Which files are necessary to be compiled?

Discussion in 'C Programming' started by Sortie, Sep 11, 2009.

  1. Sortie

    Sortie Guest

    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?
     
    Sortie, Sep 11, 2009
    #1
    1. Advertising

  2. Sortie

    jameskuyper Guest

    Richard Heathfield wrote:
    > In <Xns9C83E0E68A5D1pinkisntwellgmailcom@147.102.222.230>, Sortie
    > wrote:
    >
    > > 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?

    >
    > Assuming that your project consists of nothing but .c files, yes,
    > that's sufficient. But that isn't always the case.
    >
    > > In which cases this is not enough?

    >
    > 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.
     
    jameskuyper, Sep 11, 2009
    #2
    1. Advertising

  3. Sortie

    Richard Bos Guest

    Eric Sosman <> wrote:

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

    >
    > 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 ...
    >
    > > Is it always enough to compile just the .c files that have
    > > changed since the last full compile?

    >
    > 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
     
    Richard Bos, Sep 12, 2009
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Klaus Schneider
    Replies:
    1
    Views:
    575
    Rolf Magnus
    Dec 2, 2004
  2. lander
    Replies:
    5
    Views:
    617
    bruce barker
    Mar 5, 2008
  3. Catherina Svensson
    Replies:
    0
    Views:
    484
    Catherina Svensson
    May 19, 2008
  4. Stephen Howe
    Replies:
    1
    Views:
    273
    Victor Bazarov
    Nov 15, 2010
  5. Wolfgang Nádasi-Donner

    Which external modules are necessary for Ruby (1.9)?

    Wolfgang Nádasi-Donner, Dec 25, 2007, in forum: Ruby
    Replies:
    3
    Views:
    107
    Luis Lavena
    Dec 26, 2007
Loading...

Share This Page