473,791 Members | 2,995 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Check unnecessary Header file inclusion

Hi,

I would like to know if there is any way / tool available by which we
can detect unnecessary header files included in the source files.

Regards,
Parag.
Mar 29 '08 #1
7 2638
Parag Mahajan wrote:
Hi,

I would like to know if there is any way / tool available by which we
can detect unnecessary header files included in the source files.
Why bother?

--
Ian Collins.
Mar 29 '08 #2
On Mar 29, 12:01*am, Ian Collins <ian-n...@hotmail.co mwrote:
Parag Mahajan wrote:
I would like to know if there is any way / tool available by which we
can detect unnecessary header files included in the source files.

Why bother?
To reduce build times.

Greg

Mar 29 '08 #3
Greg Herlihy wrote:
On Mar 29, 12:01 am, Ian Collins <ian-n...@hotmail.co mwrote:
>Parag Mahajan wrote:
>>I would like to know if there is any way / tool available by which we
can detect unnecessary header files included in the source files.
Why bother?

To reduce build times.
Hardly, unless your build system is grossly underspecified.

--
Ian Collins.
Mar 29 '08 #4
On Mar 29, 2:34 am, Ian Collins <ian-n...@hotmail.co mwrote:
Greg Herlihy wrote:
On Mar 29, 12:01 am, Ian Collins <ian-n...@hotmail.co mwrote:
Parag Mahajan wrote:
>I would like to know if there is any way / tool available by which we
can detect unnecessary header files included in the source files.
Why bother?
To reduce build times.

Hardly, unless your build system is grossly underspecified.

--
Ian Collins.
One reason is to reduce the build time and another one is to actually
make sure we do have only required header inclusions in our source
files.

Regards,
Parag.
Mar 29 '08 #5
On Fri, 28 Mar 2008 23:46:41 -0700 (PDT), Parag Mahajan
<pa*****@gmail. comwrote in comp.lang.c++:
Hi,

I would like to know if there is any way / tool available by which we
can detect unnecessary header files included in the source files.

Regards,
Parag.
PC Lint from Gimpel (www.gimpel.com) can do this. It is a commercial
product, not free or open source. I have never actually used it for
this purpose on C++, but I know it works quite well in C.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.l earn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html
Mar 29 '08 #6
On Sat, 29 Mar 2008 12:38:05 -0500, Jack Klein <ja*******@spam cop.net>
wrote:
>On Fri, 28 Mar 2008 23:46:41 -0700 (PDT), Parag Mahajan
<pa*****@gmail .comwrote in comp.lang.c++:
>Hi,

I would like to know if there is any way / tool available by which we
can detect unnecessary header files included in the source files.

Regards,
Parag.

PC Lint from Gimpel (www.gimpel.com) can do this. It is a commercial
product, not free or open source. I have never actually used it for
this purpose on C++, but I know it works quite well in C.
It does also work on C++,, quite nicely.

Best regards,

Zara
Mar 31 '08 #7
In article <65************ **@mid.individu al.net>,
Ian Collins <ia******@hotma il.comwrote:
>Parag Mahajan wrote:
>Hi,

I would like to know if there is any way / tool available by which we
can detect unnecessary header files included in the source files.
Why bother?

Do you have the same opinion on:

- unused variables
- commented out unused code
- not commented out but unreachable code
- duplicated code
- unchecked error return code
- input validation
etc

Yan
Mar 31 '08 #8

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

Similar topics

8
6433
by: qazmlp | last post by:
I need to include a list of - C++ headers - headers of other modules - headers of my module - implementation specific ie.OS headers In what order, they should be included in my .CPP file? What is the best followed approach?
31
2808
by: Steven T. Hatton | last post by:
If a header is not necessarily a source file, and the sequences delimited by < and > in header names aren't necessarily valid source file names, what exactly is a header? -- p->m == (*p).m == p.m http://www.kdevelop.org http://www.suse.com http://www.mozilla.org
6
1754
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 dependencies of these dependencies and so on. This is quite ugly. A start of an "Example.cpp" file could look like this
18
2259
by: Exits Funnel | last post by:
Hello, I'm a little confused about where I should include header files and was wondering whether there was some convention. Imagine I've written a class foo and put the definition in foo.h and the implementation of its member functions in foo.cpp (which obviously #inludes foo.h) and further assume that it depends on a class bar which is defined in bar.h. It seems that there are the following two scenarios:
18
2754
by: John Smith | last post by:
Hi all What does the group think of the practise of including one header file from inside another? I have some legacy code where this has been done, and it creates a dependency on a module (collection of files) which are not required, except for one header file's contents. I'd say 'No, header files should be included in the C source, not in another
8
3052
by: nrhayyal | last post by:
Hi c++ Gurus, Need your blessing. while testing few aspects with respect to header file inclusions, i observed few things which i would like to share with you. i have a file sqlca.h in which a structure sqlca is declared. i included this file as a soft link in /usr/include. the soft link is as follows: sqlca.h -> /usr/opt/db2_08_01/include64/sqlca.h
6
5207
by: techBoy | last post by:
I am looking for a tool that can scan my soyrce code and check if a header file gets included more then once in a sequece of compiled code. Can some one guide me to such a tool !!
16
2090
by: wdh3rd | last post by:
Hi everyone. I'm new to C and I have a few questions: I am making files for permutations and combinations. Files to be made are perm.c, perm.h, combo.c, and combo.h. Since both combinations and permutations use factorial to solve their problems, factorial is supposed to be in both perm.c and combo.c, and declared private. (1) You wouldn't ever put a prototype in a header if that function was
14
1778
by: Martin Wells | last post by:
When I have errors in a program, whether they be compiler errors, linker errors, or if the program crashes when running, I have a list of things I check for initially. If I get an error for something undeclared, the first thing I do is go through my header files and check that the inclusion-guard macro is specific to that header file. For instance, if the header file is called "data.h", I make sure the inclusion guard is "H__DATA" and...
0
9669
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
9515
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
10427
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
10207
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9029
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, 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...
0
5431
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...
1
4110
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
3718
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2916
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.