Re: Organisation of C programs
From: Thomas Matthews (Thomas_MatthewsSpitsOnSpamBots_at_sbcglobal.net)
Date: 07/28/04
- Next message: Jeffrey Barrett: "Re: Why is this crashing??"
- Previous message: Jackie: "Re: test"
- In reply to: Richard Evans: "Organisation of C programs"
- Next in thread: Rowland: "Re: Organisation of C programs"
- Reply: Rowland: "Re: Organisation of C programs"
- Reply: Christopher Benson-Manica: "Re: Organisation of C programs"
- Reply: Richard Evans: "Re: Organisation of C programs"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 28 Jul 2004 14:10:21 GMT
Richard Evans wrote:
> Hello,
>
> I am unsure of whether is Question is apt for this group, but
> that has never stopped anybody else.
>
> I believe I have a good understanding of the C language since my
> last post many years ago about passing pointers in functions.
>
> So now I am looking for resources describing how to layout and
> organize the parts of a program into subdirectories, how to
> include exported library headers, local headers and the overall
> collection of common includes, include guards, and preprocessor
> statements.
>
> I thought I would give people something different to talk about.
>
> Thanks in advance.
>
> Richard
>
This becomes a religious issue: everybody has their own
belief as to what is correct.
A common layout is:
Project
|
+-------
| |
docs source
|
----- include
Where the source contains all the ".c" files and the
include contains all the ".h" or header files.
I favor grouping by theme:
|
+-------------+---+----+--------+------------->
| | | |
utilities Flash UART Containers
In my opinion, this allows for better reuse of code.
Just point the search path to the correct directories.
I believe that processor specific code should be in
sub-directories under the themes (such as utilities
using processor specific features or assembly language).
I've only had one shop agree to to this. Most prefer to
dump all the files into one directory per project. That
way all the files can be easily duplicated for another
project (that is their definition of code reuse).
--
Thomas Matthews
C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book
- Next message: Jeffrey Barrett: "Re: Why is this crashing??"
- Previous message: Jackie: "Re: test"
- In reply to: Richard Evans: "Organisation of C programs"
- Next in thread: Rowland: "Re: Organisation of C programs"
- Reply: Rowland: "Re: Organisation of C programs"
- Reply: Christopher Benson-Manica: "Re: Organisation of C programs"
- Reply: Richard Evans: "Re: Organisation of C programs"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|