473,624 Members | 2,534 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

header file size effect

hi group,

Does the header file size or number in include(s) effect the size of
executable file?
In other world if i chose a large header file and include it with my
source file does it increase the size of the executable outcome at the
end?

thanks
Feb 19 '08 #1
6 3431

"bobby" <bs*****@gmail. comwrote in message
news:65******** *************** ***********@41g 2000hsc.googleg roups.com...
hi group,

Does the header file size or number in include(s) effect the size of
executable file?
In other world if i chose a large header file and include it with my
source file does it increase the size of the executable outcome at the
end?
Typically no.
Header usually contain prototypes and definitions of constants and
structures. All this textual apparatus is stripped away in the process of
compilation. Only code you actually call will inflate the executable.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Feb 19 '08 #2
On Feb 19, 11:13 am, "Malcolm McLean" <regniz...@btin ternet.com>
wrote:
"bobby" <bsim...@gmail. comwrote in message

news:65******** *************** ***********@41g 2000hsc.googleg roups.com...hi group,
Does the header file size or number in include(s) effect the size of
executable file?
In other world if i chose a large header file and include it with my
source file does it increase the size of the executable outcome at the
end?

Typically no.
Header usually contain prototypes and definitions of constants and
structures. All this textual apparatus is stripped away in the process of
compilation. Only code you actually call will inflate the executable.

--
Free games and programming goodies.http://www.personal.leeds.ac.uk/~bgy1mm
This make sense
However I searched and found this forum at : http://forums.pcquest.com/forum/viewtopic.php?t=3999
that indicate "the larger the size of the header file , larger the
size of ur executable"
moreover it adds "Since this is a case of static binding, more the
size of ur executable, more is the system memory utilization"

It also recommend to divide header file into parts/groups so that your
program runs faster and their is no unnecessary searching which might
result in collision of declarations. comes from http://www.codeguru.com/cpp/tic/tic0056.shtml

I appreciate if you can clarify this for me

thanks
Feb 19 '08 #3
"bobby" wrote:

c1**********@e2 3g2000prf.googl egroups.com...
On Feb 19, 11:13 am, "Malcolm McLean" <regniz...@btin ternet.com>
wrote:
>"bobby" <bsim...@gmail. comwrote in message

news:65******* *************** ************@41 g2000hsc.google groups.com...>
hi group,
Does the header file size or number in include(s) effect the size of
executable file?
In other world if i chose a large header file and include it with my
source file does it increase the size of the executable outcome at the
end?

Typically no.
Header usually contain prototypes and definitions of constants and
structures. All this textual apparatus is stripped away in the process of
compilation. Only code you actually call will inflate the executable.

--
Free games and programming
goodies.http://www.personal.leeds.ac.uk/~bgy1mm

This make sense
However I searched and found this forum at :
http://forums.pcquest.com/forum/viewtopic.php?t=3999
that indicate "the larger the size of the header file , larger the
size of ur executable"
moreover it adds "Since this is a case of static binding, more the
size of ur executable, more is the system memory utilization"

It also recommend to divide header file into parts/groups so that your
program runs faster and their is no unnecessary searching which might
result in collision of declarations. comes from
http://www.codeguru.com/cpp/tic/tic0056.shtml

I appreciate if you can clarify this for me
Taking what you said at face value, I would say there is a lot of
mis-information on the Web. Printed too. I saw an article that said C dd
not have a "go to". In the second graf, they said "program" when they meant
"compiler"
Feb 19 '08 #4

"bobby" <bs*****@gmail. comwrote in message
news:f6******** *************** ***********@e23 g2000prf.google groups.com...
On Feb 19, 11:13 am, "Malcolm McLean" <regniz...@btin ternet.com>
wrote:
>"bobby" <bsim...@gmail. comwrote in message

news:65******* *************** ************@41 g2000hsc.google groups.com...>
hi group,
Does the header file size or number in include(s) effect the size of
executable file?
In other world if i chose a large header file and include it with my
source file does it increase the size of the executable outcome at the
end?

Typically no.
Header usually contain prototypes and definitions of constants and
structures. All this textual apparatus is stripped away in the process of
compilation. Only code you actually call will inflate the executable.
This make sense
However I searched and found this forum at :
http://forums.pcquest.com/forum/viewtopic.php?t=3999
that indicate "the larger the size of the header file , larger the
size of ur executable"
moreover it adds "Since this is a case of static binding, more the
size of ur executable, more is the system memory utilization"
That thread was possibly about why standard C headers such as stdio.h,
time.h, always seem to be included individually, and what the penalty would
be of simply including all of them.

In fact why not just include all of them (by using a new header that just
contains a dozen or two #includes), in every program instead of having to
pick and choose every time? All the standard headers combined is still tiny
compared with say windows.h, it shouldn't affect compilation times:

#include <stdc.h>

Seems simple to me.

--
Bart


Feb 19 '08 #5

"bobby" <bs*****@gmail. comwrote in message
news:f6******** *************** ***********@e23 g2000prf.google groups.com...
This make sense
However I searched and found this forum at :
http://forums.pcquest.com/forum/viewtopic.php?t=3999
that indicate "the larger the size of the header file , larger the
size of ur executable"
moreover it adds "Since this is a case of static binding, more the
size of ur executable, more is the system memory utilization"

It also recommend to divide header file into parts/groups so that your
program runs faster and their is no unnecessary searching which might
result in collision of declarations. comes from
http://www.codeguru.com/cpp/tic/tic0056.shtml

I appreciate if you can clarify this for me
That could be about C++.
In C++ the convention is to place inline code into header files. Inlined
functions do blow u[ the size of the executable. Though it isn't likely to
be an issue on modern PCs, some early programmers got a shock when they saw
just how big their C++ programs were in relation to the same program in C.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm

Feb 19 '08 #6
bobby wrote:
On Feb 19, 11:13 am, "Malcolm McLean" <regniz...@btin ternet.com>
wrote:
>"bobby" <bsim...@gmail. comwrote in message

news:65******* *************** ************@41 g2000hsc.google groups.com...hi group,
>>Does the header file size or number in include(s) effect the size of
executable file?
In other world if i chose a large header file and include it with my
source file does it increase the size of the executable outcome at the
end?
Typically no.
Header usually contain prototypes and definitions of constants and
structures. All this textual apparatus is stripped away in the process of
compilation. Only code you actually call will inflate the executable.

This make sense
However I searched and found this forum at : http://forums.pcquest.com/forum/viewtopic.php?t=3999
that indicate "the larger the size of the header file , larger the
size of ur executable"
moreover it adds "Since this is a case of static binding, more the
size of ur executable, more is the system memory utilization"

It also recommend to divide header file into parts/groups so that your
program runs faster and their is no unnecessary searching which might
result in collision of declarations. comes from http://www.codeguru.com/cpp/tic/tic0056.shtml

I appreciate if you can clarify this for me
Sure. The first thing you quote is utter and absolute garbage. The
second one is largely about C++ rather than C; I've not read it
thoroughly, but you need to think carefully about the summary you gave.
How many header files will need to be searched if all the relevant
information is in one header? How many will need to be searched if it is
split over several headers? How likely are you to accidentally duplicate
names and declarations if you are maintaining several headers rather
than one?

It's important to think carefully how to arrange your information in
headers. Neither "one" nor "many" is the right answer for all cases. for
small programs with a few .c files, a single header often makes sense.
For larger projects, especially ones which are logically split into
different groups of functionality, it might make sense to have a header
for each of these groups containing the information which is essentially
private to that group, and another to contain all the program-wide
information which pulls the whole thing together.

In general, things like how long it takes to search headers are the last
things you should be worrying about. Forget about it, arrange your
headers logically for the overall program structure. Search times are
only likely to possibly become an issue with really huge projects, and
by the time you're in a position to be making decisions about things
like that you should have enough experience to get it right. One thing
to remember is that these are all compile-time issues only, they have no
effect on the final program. You're worrying about saving milliseconds
of compilation time for small projects, not normally something worth the
effort.
Feb 19 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
562
by: Daniel Nichols | last post by:
I've noticed that in a C module (.c, .h file combination) that if you create a function's definition before it is used in other functions than a declaration is not necessary. I believe if the compiler can find the definition of the function prior to encountering the use of the function it will generate the prototype itself. I don't currently use this feature, I explicitly create declarations for all functions in a header file. However, I...
0
3927
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen. It is almost like it is trying to implement it's own COM interfaces... below is the header, and a link to the dll+code: Zip file with header, example, and DLL:...
18
3574
by: Al | last post by:
I'm still trying to do this but it never worked! In a .cpp file, I write the code, and at the beginning, I write: #ifndef MYLIST_H #define MYLIST_H ....to end: #endif What's wrong with it for creating a header file when compiling? Do I need to write in the block the #include (s)?
1
4594
by: C. Jayachandran | last post by:
I've inherited some code which has const std::string values defined in a header file, like const std::string str = "foo"; This causes a large amount of bloat, as all the compilation units including this header file will have a copy of the string, as well as code to construct and destruct the string, even if the string is not used within the CPP file.
5
3728
by: Jefferis NoSpamme | last post by:
Hi all, I'm trying to limit the file size of an image submission and I keep running into various problems. I've got most of it working, but I'm stumped and I have a basic question as to WHY this works at all! if ($_FILES !="") { if ($_FILES<=0) { header("Location: /fileerror.php"); exit; }
14
11727
by: Jess | last post by:
Hello, I was told that if I have a template class or template function, then the definitions must be put into the header file where I put the declarations. On the other hand, it is generally good to put source code and declaration into separate files (.h head filer and .cpp source file). What can I do to template functions/classes? Do I have to put them all into one header file? Thanks,
0
955
by: rwingv | last post by:
Hi, This is my first post, so please be patient. I am also relatively new to C# on an XP machine, which is what I am attempting to code in. Here my problem: I am modifying code already created and need to add another database to the mix. I created the db in SQL Server 2005 Express. When I try to add it to the program thru Database Explorer I am getting the message, "The header for file xxxx is not a valid database header file. The...
3
1522
by: Xohaib | last post by:
hey guys i wnat to make a my own header file like i want that i make a header file exmple.h and i want that when i use exmple.h i should not need to include iostream.h and one other header files like this. So how can i make it in VC++ (IDE). I shall b very thankfull to you.......
11
2526
by: subramanian100in | last post by:
Suppose the following is in Test.h #ifndef TEST_H #define TEST_H #include <iostream> #include <string> using namespace std;
0
8231
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, 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...
0
8168
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,...
0
8672
Oralloy
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...
0
8471
tracyyun
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...
1
6107
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 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...
0
4075
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4167
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2603
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
2
1474
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 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...

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.