473,505 Members | 14,394 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question about including files and a generic header file.

26 New Member
Hey there,

I'm just wondering something. If I created a generic header file that contained all of my inclusions that I needed and then just included that one file in all subsequent files, would it be safe?

I know it would TECHNICALLY work, but my concern is that it would bloat the program, create errors from some inclusion exception or if it is just frowned upon in the industry for some reason.

Any advice on whether or not to do this is much appreciated.
Nov 16 '09 #1
2 1509
Banfa
9,065 Recognized Expert Moderator Expert
That is one of those personal choice things. Some people frown on such an approach and some people like it.

It will (well should) not bloat your program, the program is made from executable code, generally this is the code that appears in your source files.the headers just contain definitions of symbols (types, functions, variables and preprocessor) which is information for the compiler rather than source code that produces executable code.

What you may find (if it is a lot of files) is that it slows down compilation. How critical this is depends on the number and size of the headers which effects how much the compilation slows for a single file and the number of source files in your project.

For example if you get just a half second slow down in compilation of a project with 1000 source files that equates to 8 minutes more compilation time for a complete build.
Nov 16 '09 #2
Jajjo
26 New Member
Right on, thanks for the input :)
Nov 17 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

10
2273
by: da Vinci | last post by:
Hello. First off, I am not sure of the exact jargon used, so I will ask a question regarding it. Then on to my other question. When you use things like cout and cin from the iostream header...
6
1734
by: Johannes Bauer | last post by:
Hi group, I've got a question concerning inclusion of .hpp files. Currently I'm including all needed header files in the .cpp file. This means all dependencies of the package and all...
2
2194
by: Kevin Joplin | last post by:
Hi there, I've almost finished writing simple server application and i have one little doubt. Suppose we have main server code in server.c file. Rest of the code we divided into some pices and put...
36
3294
by: Geiregat Jonas | last post by:
I've got this small app , from 2 .c files. One file contains the main and the other file contains functions used in the main. I compile this using gcc like this: gcc -c *c && gcc -o app *o. But I...
10
5480
by: PCHOME | last post by:
Hi! Would someone please help me thess C error(in gcc on Linux)? The compiler continues to give me: readLP.o: In function `Input_Problem': readLP.o(.text+0x0): multiple definition of...
1
1048
by: Robby | last post by:
Hello: Can we pass a pointer to an object from one cpp file to another by using a function call. Assuming the object was created and declared along with its accessor methods in the first cpp...
11
1858
by: mdh | last post by:
Well, K& R has finally gotten to header files!!! May I ask this. (Have checked out the FAQ) I am using "Xcode" to compile the program, so it may well be that this is doing something strange. ...
5
3902
by: mark_overstreet | last post by:
I have a generic data layer DLL that expects to read its connection string from it's own config file. The dll and config file have been placed in the bin directory (VS.NET2005). However, due to...
3
2562
by: KIRAN | last post by:
Hello all, My question is about the way of including header files(*.h) in source files (*.c) I have three folders, -build ( for project makefiles) -include ( for *.h files) -src (for *.c...
0
7216
marktang
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,...
0
7367
jinu1996
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...
1
7018
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...
0
5613
agi2029
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,...
1
5028
isladogs
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...
0
4699
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...
0
3187
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
407
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.