473,326 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

include cleanup

Hello

Is there a tool that helps to keep the list of include directives
clean and tidy? I would like that each header/source file has only the
includes that it really needs, and that forward declarations are used
instead of includes where possible.
I can imagine that this task is impossible to solve in general, but I
hope there are tools that get the job at least partially done.

Flo
Jan 23 '08 #1
5 1692
Florian Kaufmann wrote:
Is there a tool that helps to keep the list of include directives
clean and tidy? I would like that each header/source file has only the
includes that it really needs, and that forward declarations are used
instead of includes where possible.
I can imagine that this task is impossible to solve in general, but I
hope there are tools that get the job at least partially done.
I call it "the combination of your text editor and the compiler".
Start by removing all includes and then include only those that are
needed.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jan 23 '08 #2
I call it "the combination of your text editor and the compiler".
Start by removing all includes and then include only those that are
needed.
Yes, that is surely possible. However, the automated approach has the
advantage that the work is done by someone else (the tool) and I can
concentrate on the important stuff. I imagine it quite time consuming
to do the manual approach every half year or so for all the hundredths
source/header files.
Jan 23 '08 #3
In article <e8**********************************@t1g2000pra.g ooglegroups.com>,
Florian Kaufmann <se*******@gmail.comwrote:
>Hello

Is there a tool that helps to keep the list of include directives
clean and tidy? I would like that each header/source file has only the
includes that it really needs, and that forward declarations are used
instead of includes where possible.
[OT]
The latter part of that is not recommended. If you have the same
function declaration in multiple files, then when you change
the declaration, you will have to go around to each file that
textually declares it and modify the code. That process is error
prone; it is pretty much inevitable that the declarations *will*
get out of sync. If, however, you #include the declaration of
the header, then you only need to modify one place, the #include
file, after which the compiler will be able to catch any
now-incompatible calls to the function.
--
"History is a pile of debris" -- Laurie Anderson
Jan 23 '08 #4
Florian Kaufmann wrote:
Hello

Is there a tool that helps to keep the list of include directives
clean and tidy? I would like that each header/source file has only the
includes that it really needs, and that forward declarations are used
instead of includes where possible.
I can imagine that this task is impossible to solve in general, but I
hope there are tools that get the job at least partially done.

Flo
try this:
http://www.stolk.org/idep-0.5.tar.gz
Jan 23 '08 #5
On Wed, 23 Jan 2008 01:14:14 -0800, Florian Kaufmann wrote:
Hello

Is there a tool that helps to keep the list of include directives clean
and tidy? I would like that each header/source file has only the
includes that it really needs, and that forward declarations are used
instead of includes where possible.
I can imagine that this task is impossible to solve in general, but I
hope there are tools that get the job at least partially done.

Flo
PC-lint will do this.

http://www.gimpel.com/

--
Billy
Jan 24 '08 #6

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

Similar topics

6
by: use dmgass at hotmail dot com | last post by:
I'm writing a module and when it is imported by a script I want some code automatically executed when the importing script is finished executing. I'd like it to execute before interactive mode is...
0
by: Tom Bates | last post by:
Can I include the same include files in global.asa that I use in other ..asp scripts? I haven't been able to make it work. My O'Reilly book says that global.asa can have includes, but the syntax...
9
by: Mark Stijnman | last post by:
I need to use an API in our current project and I have been writing some wrapper classes for the functionality we need. Unfortunately, before you can use any API calls, the API must be initialized,...
2
by: gl | last post by:
I currently have an asp.net web app that starts a thread in the global.asax app start method. THe thread then runs for the duration of the app's life, changing data in the background. My...
6
by: Rémi | last post by:
Can someone tell me whether or not my assumptions are good? Just want to know if I'm going to run into trouble in how I'm deleting map entries. Although I like to think I know my way around C++,...
69
by: MQ | last post by:
Hi all I am just wondering how most people implement cleanup in C functions. In particular, if the function opens a number of resources, these need to be released properly should an error occur...
3
by: Petr Pavlu | last post by:
Hello, I have two questions how the functions should be written. I read the FAQ but didn't find any answer. If there is any please point me out. I. Cleanup code Consider I have to open file1,...
5
by: Florian Kaufmann | last post by:
Hello Is there a tool that helps to keep the list of include directives clean and tidy? I would like that each header/source file has only the includes that it really needs, and that forward...
6
by: Peter Michaux | last post by:
I just ran some circular memory leak tests in IE6, O9, S3, FF2 and it seems to me they all benefit from doing the same kind of circular memory leak cleanup that IE requires. My tests were very...
4
by: IanWright | last post by:
I've got a section of a program that I can't quite get to work. I'm fairly sure its something very simple/trivial but it looks correct to me, so if someone could help me fix the problem, and explain...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.