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 6 1035
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
"Thomas Matthews" <Th****************************@sbcglobal.net> wrote in
message news:ht*****************@newssvr19.news.prodigy.co m... Richard Evans wrote:
<snip> 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.
<snip> 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
I really like that, and think I might start doing it that way in future.
I've always tended to do it on a per-project basis, like you first
described. I would store all my projects in their own subdirectories of
\dev\null, but, as you say, code-reuse was impossible...
Thomas Matthews <Th****************************@sbcglobal.net> spoke thus: 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).
To a large extent, that's the definition I'm working under, and it's
pretty pitiful.
--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Christopher Benson-Manica wrote: Thomas Matthews <Th****************************@sbcglobal.net> spoke thus:
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).
To a large extent, that's the definition I'm working under, and it's pretty pitiful.
I have come across a book "Large scale C++ software Design" by Lakos.
It discusses layout based on dependencies of class friendship,
procedural and variable privacy and is very terse reading focussed
it seems on the C++ issues rather than its C issues.
I was after something specifically focussed on C.
While I don't want to be unix centric, introductions to the
automake/conf tools seem to briefly define some structure. This seems
like a significant details to focus someones experience into discussing.
Thomas Matthews wrote: 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.
Does this mean you have had this discussion before or read about it
in a group? I would like to read it if you know when and where.
Richard
"Richard Evans" <ra******@hotmail.com> wrote I have come across a book "Large scale C++ software Design" by Lakos. It discusses layout based on dependencies of class friendship, procedural and variable privacy and is very terse reading focussed it seems on the C++ issues rather than its C issues.
The most important concept for code reuse is dependency. The more
dependencies a piece of code has, the less likely you are to reuse it. This
is true in C as well as C++. I was after something specifically focussed on C. While I don't want to be unix centric, introductions to the automake/conf tools seem to briefly define some structure. This seems like a significant details to focus someones experience into discussing.
My technique is this. We divide the source files into four groups.
1) Many programs, any platform. (eg a quaternion function for graphics)
2) Many programs, this platform only (eg a fast screen clear for a console)
3) This program only, any platform (eg AI for a space invader)
4) This program only, this platform only (eg the user interface)
You try to write the code so that as much goes into group 1 as possible and
as little into group 4 as possible.
It's a very simple procedure, but keeps things fairly neat. The fly in the
ointment is when code that is essentially in a low group depends on a minor
function that has to go in a higher group. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Alain FONTAINE |
last post by:
I am searching a kind of software engineering document about PHP. This
document should give advices about PHP project organisation (structure
of files, directories, names). Shall I organize...
|
by: David M. Wilson |
last post by:
Hello!
I maintain a small package for talking to the API of BulkSMS.co.uk. I
have been adding support for some new features recently, and found
myself slightly indecisive over how best to lay...
|
by: Aksahy |
last post by:
Hiii,
I am developing an ASP application over IIS5.0 over win2kproffesional
In our organisation we use Outlook along with MS-Exchange for Email
communication.
Now, i want to build an app, to...
|
by: vasanth kumar |
last post by:
Hi All,
Can someone tell me, is there any component available for creating
Organisation Chart. I hope, I don't have to write code for creating boxes &
lines for creating this Org Chart.
...
|
by: Stuart Turner |
last post by:
Hi Everyone,
I'm working hard trying to get Python 'accepted' in the organisation I work
for. I'm making some good in-roads. One chap sent me the text below on
his views of Python. I wondered...
|
by: boclair |
last post by:
I would be interested in articles on markup of organisation trees in an
html document, other than as an image.
Louise
|
by: rony steelandt |
last post by:
Imagine I have x projects and they all use util.py
What would be the best way to organise this
1.
c --\project1\*.py
|
|-\project2\*.py
|
--\globals\util.py
|
by: phanipep |
last post by:
explain what is a indexed sequential file organisation,also give two advantages of sequential of indexed sequential file organisation ?
|
by: David Mearsen |
last post by:
Hi,
I've recently started programming C after many years using "the other
language"... I just wanted to find out the common practice for
organising source files.
Specifically, consider a...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |