Hi,
I have seen two main methods of organizing the header and source files
in a C++ project. The first method separates the public header files
from the remaining files (i.e., source files and internal/
implementation header files) -- the public header files are usually
stored in a directory named "include", and the remaining files are
stored in another directory named "src". The structures of these two
directories are usually closely related. For example, Postgres adopts
this organization.
The second method does not enforce such a separation -- files are
placed in directories according to which software module they belong
to, so that header files and source files belonging to the same module
will be placed within the same directory.
What are the trade-offs?
Thanks!
Mingsheng 3 3610
mshngo wrote:
Hi,
I have seen two main methods of organizing the header and source files
in a C++ project. The first method separates the public header files
from the remaining files (i.e., source files and internal/
implementation header files) -- the public header files are usually
stored in a directory named "include", and the remaining files are
stored in another directory named "src". The structures of these two
directories are usually closely related. For example, Postgres adopts
this organization.
The second method does not enforce such a separation -- files are
placed in directories according to which software module they belong
to, so that header files and source files belonging to the same module
will be placed within the same directory.
What are the trade-offs?
I've worked with both and now prefer the latter. My main reason is the
subdirectories can map to namespaces, disambiguating files names.
--
Ian Collins.
mshngo wrote:
....
>
What are the trade-offs?
Code modularity is sacrificed with the first method. Modularity is
important in large projects.
You somewhat have more work to manage the include paths, however that
can be easily automated. I wrote MakeXS to do just that - automate as
much of the mechanical tasks as I could - making it as easy as dropping
in a file and typing "make".
makexs is now available from Austria C++. http://austria.sourceforge.net/
There are other build systems, cmake for example. MakeXS is still using
make. (gmake to be exact).
On Apr 7, 2:53 am, mshngo <msh...@gmail.c omwrote:
I have seen two main methods of organizing the header and
source files in a C++ project. The first method separates the
public header files from the remaining files (i.e., source
files and internal/ implementation header files) -- the public
header files are usually stored in a directory named
"include", and the remaining files are stored in another
directory named "src". The structures of these two directories
are usually closely related. For example, Postgres adopts this
organization.
The second method does not enforce such a separation -- files
are placed in directories according to which software module
they belong to, so that header files and source files
belonging to the same module will be placed within the same
directory.
What are the trade-offs?
I presume you're referring to the development code; in delivered
code, the headers are almost always in a separate directory from
the sources, since the sources aren't part of the base
deliverables, and the headers are. (Even if your project is
open source, you don't want users to have to -I on your source
directories---or at least, the users won't want to.) This
argues somewhat for a separation during development as well;
ensure that you're not accidentally including a header which
won't be delivered when you compile your tests, for example.
And having less files in the directories may also improve search
times for the compilers. But such differences are probably
very minor.
--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: FISH |
last post by:
Ever have one of those days when you're not sure if it's you who's gone
mad, or the rest of the world?
I have an Open Source project on SourceForge for communication with YSMG
- Yahoo's IM protocol. I keep the project source in three directories,
based upon the code's function: one for the network API code itself, one
for the support APIs (basic chat spam filtering, Swing models, rich text
decoders, etc), and one for the test client...
|
by: ^_^ |
last post by:
conversion from:
a="a";
to
a=0x????;
If there are many unicode strings to convert, how can I do batch-conversion?
|
by: pillepop2003 |
last post by:
Hey!
Can anyone give me a hint, how this problem is best implemented:
I have a table of users (see below), where every user has one
"superior user" (= parent node), this should be a fully unambigous
tree structure. The root node can have whatever value you prefer, I
suppose NULL would be good for a start. What I want to do is finding
the way from an arbitrary node in the tree.
Example:
|
by: Christian Fowler |
last post by:
I have a VERY LARGE pile of geographic data that I am importing into a database (db of choice is postgres,
though may hop to oracle if necessary). The data is strictly hierarchical - each node has one, and only one
parent. The depth should not exceed 6 or 7 levels. The initial import will have about 6 million leaves, and
3 million branches. I would expect the leaves to grow significantly, in number easily tripling. However, the
branches will...
|
by: Zri Man |
last post by:
I'm relatively new to DB2 and was reasonably amused to see the REVERSE
SCAN availability for Indexes.
My assumptions are as follows:
DB2/UDB uses B-Tree for indexing by default and is likely the main
offering for Indexing within the DB.
Reverse Scans could possibly only happen on the the leaf node of
the index
| |
by: Stephan Tobies |
last post by:
Hi everyone,
I am looking for a good data structure that could be used to represent
families of trees with shared sub-trees and copy-on-write semantics.
On a very abstract level, I would like to have an API like this:
Let Node be a suitably defined data structure. Then the following
functions shall be supported:
|
by: David W. Simmonds |
last post by:
Outside of building a custom ActiveX control that would need to run on the
user's machine and have security attributes set to allow such, does anyone
have any code that will allow a combobox to display a tree of items? I could
display a tree control, but that takes a lot of space on the page. I have
seen comboboxes in non-web apps uses such a thing. I want to be able to
display a tree in a compact fashion. Any ideas would be appreciated.
|
by: nd02tsk |
last post by:
Hello
Why is it that PostgreSQL chooses to have features like replication,
fulltext indexing and GIS maintained by others outside of the sourcetree?
I appreciate any answers.
Thank you.
Tim
|
by: _DS |
last post by:
Problem with mapping a directory tree to a tree control: It takes a
while to recurse subdirs and map them to nodes. This is solved in
some books I've seen (MacDonald, Albahari) by reading the subdir only
when its node on the tree control is opened.
Has anyone pre-packaged this functionality into a control?
|
by: Ron Adam |
last post by:
I'm new to element tree and haven't been able to find a simple solution
to this problem yet. So maybe someone can point me in the right direction.
I have an element tree structure of nested elements that I want to
convert to html as nested definition and unordered lists in the
following way.
<object>
<name>ball</ball>
<desc>
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |