Is there a difference between a "module" and a "compilation unit" ?

Discussion in 'C Programming' started by Bob, Mar 20, 2005.

  1. Bob

    Bob Guest

    Are they different names for the same concept ?
     
    Bob, Mar 20, 2005
    #1
    1. Advertising

  2. Bob

    Chris Torek Guest

    In article <>
    Bob <> wrote:
    >Are they different names for the same concept ?


    [For clarity about the pronoun "they", I will repeat the subject
    line for those whose news-delivery systems mangle it:]

    >Is there a difference between a "module" and a "compilation unit" ?


    That depends on who does the defining, no? :)

    The C standards define the term "translation unit". They do not
    define either "compilation unit" or "module". Thus, this newsgroup
    (comp.lang.c) cannot give you a definitive answer to the question.

    In languages that actually have modules (such as Modula-2 and
    Modula-3), I might claim there is a subtle difference, in that
    a module may require more than one compilation step and each
    such step could be termed a "unit". But you would have to define
    these terms with respect to C before you could get an answer.
    --
    In-Real-Life: Chris Torek, Wind River Systems
    Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
    email: forget about it http://web.torek.net/torek/index.html
    Reading email is like searching for food in the garbage, thanks to spammers.
     
    Chris Torek, Mar 20, 2005
    #2
    1. Advertising

  3. Bob

    Bob Guest

    Re: Re: Is there a difference between a "module" and a "compilation unit" ?

    On 20 Mar 2005 20:25:44 GMT, Chris Torek <> wrote:

    >>Is there a difference between a "module" and a "compilation unit" ?

    >
    >That depends on who does the defining, no? :)


    Yes.

    >The C standards define the term "translation unit". They do not
    >define either "compilation unit" or "module". Thus, this newsgroup
    >(comp.lang.c) cannot give you a definitive answer to the question.


    So be it: "translation unit" will be used (by me) from now on. :)

    Thanks.
     
    Bob, Mar 20, 2005
    #3
  4. Bob

    pete Guest

    Bob wrote:
    >
    > On 20 Mar 2005 20:25:44 GMT, Chris Torek <> wrote:
    >
    > >>Is there a difference between a "module" and a "compilation unit" ?

    > >
    > >That depends on who does the defining, no? :)

    >
    > Yes.
    >
    > >The C standards define the term "translation unit". They do not
    > >define either "compilation unit" or "module". Thus, this newsgroup
    > >(comp.lang.c) cannot give you a definitive answer to the question.

    >
    > So be it: "translation unit" will be used (by me) from now on. :)


    A translation unit is the output of the preprocessor.
    A translation unit consists of a sequence of external declarations.

    --
    pete
     
    pete, Mar 21, 2005
    #4
  5. pete wrote:
    -> Bob wrote:
    -> > Chris Torek <> wrote:
    -> > > > Is there a difference between a "module" and a
    -> > > > "compilation unit" ?
    -> > >
    -> > > That depends on who does the defining, no? :)
    -> >
    -> > Yes.
    -> >
    -> > > The C standards define the term "translation unit". They do
    -> > > not define either "compilation unit" or "module". Thus, this
    -> > > newsgroup (comp.lang.c) cannot give you a definitive answer
    -> > > to the question.
    -> >
    -> > So be it: "translation unit" will be used (by me) from now on. :)
    ->
    -> A translation unit is the output of the preprocessor.
    -> A translation unit consists of a sequence of external declarations.

    Section 5 says... "An implementation translates C source files..."

    "Source file" probably makes more sense than translation unit, or
    preprocessing translation unit (which by definition may consist of
    more than one file.)

    Although programming has the concept of modules, C generally doesn't.
    There is no immediate way to share objects with external linkage
    exclusively within a select group of source files.

    --
    Peter
     
    Peter Nilsson, Mar 21, 2005
    #5
  6. Bob

    Bob Guest

    Re: Re: Is there a difference between a "module" and a "compilation unit" ?

    On 21 Mar 2005 03:19:54 -0800, "Peter Nilsson" <>
    wrote:

    >Although programming has the concept of modules, C generally doesn't.
    >There is no immediate way to share objects with external linkage
    >exclusively within a select group of source files.


    Exactly. Something like what Delphi does for example, if I'm not
    mistaken.
     
    Bob, Mar 21, 2005
    #6
    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.

Share This Page