Sidebar on include.h (was getting rid of mkproto.sh from Samba3

David Collier-Brown davec-b at rogers.com
Mon Jun 4 16:14:13 GMT 2007


Volker Lendecke wrote:
>> And, I would *like* to keep our includes.h. It is a
>> nightmare in Samba 4 to pick all necessary includes, and
>> this will fill very quickly with obsolete includes if you
>> change something.

James Peach wrote:
> Yep, "includes.h" is nice'n'easy and also plays well with precompiled  
> headers. It would be nice to give some modules the option of including  
> less that everything, however.

   This is a discussion most teams have every few years, as it's
something of a trade-off (:-))

   If you put everything in an include.h file, you'll pay the
price in compile speed, unless your compiler has a specific
mechanism (kludge?) to deal with them like precompiled headers.
You'll also detect any contradictions still present in vendor
include files (;-))

   If you don't include the kitchen sink, you'll find .h's missing
during development, just after you've added a call to something.
Over time you'll also collect no-longer-needed headers, unless
(like gcc -MMD) you have a compiler has a specific mechanism to
tell you what includes you need.

   A customer of mine now occasionally uses -MMD, .d files and a
script to prune out extra #include files when they're using gcc,
and lint|grep "unneeded" when they're using a vendor compiler.

--dave
-- 
David Collier-Brown,         | Always do right. This will gratify
System Programmer and Author | some people and astonish the rest
davecb at spamcop.net           |                      -- Mark Twain
(416) 223-5943


More information about the samba-technical mailing list