[9fans] Include guards and multiple includes

  • Permalink
  • submit to reddit
  • Email
  • Follow


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm trying to convince some non-believers that include files should  
not include other include files, and that instead they should state  
their dependencies; they want hard data before they commit to such a  
scheme.

Is there some study kicking around that I could point them at rather  
than re-factor our code base and time the resulting builds?  I know  
the plan9 headers largely follow this pattern.

Paul

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFFORlRpJeHo/Fbu1wRAlExAKCsTZtCcW9FlqvUwllBye9EgRGqGwCgnYZn
0QcMNw3eC6a/3/XINvcD/Qw=
=H755
-----END PGP SIGNATURE-----
0
Reply plalonde (269) 10/20/2006 6:48:58 PM

See related articles to this posting


> Is there some study kicking around that I could point them at rather
> than re-factor our code base and time the resulting builds?  I know
> the plan9 headers largely follow this pattern.

I'm fairly certain it's a stylistic/maintainability issue on Plan 9,
not an efficiency one.

--Joel
0
Reply joelcsalomon (309) 10/20/2006 7:28:17 PM

I think that one of the best arguments for organising header files as
Plan 9 does is the mess that /usr/include has become on (l)unix.  It's
almost 20MB on Suse 9.1.

Here's an interesting exercise for people who don't see a problem with
how (l)unix organises /usr/include:

Ask someone (ideally a manager, the higher the rank, the better) to
find out where under /usr/include on Linux the type time_t is defined
and the signal SIGINT is declared without using grep or any
equivalent; they should trace through the include files visually.  If
they return with the correct answers and aren't disgusted with the
mess under /usr/include, slap some pointy hair on them.

0
Reply geoff755 (337) 10/20/2006 11:21:29 PM

On 10/21/06, Paul Lalonde <plalonde@telus.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I'm trying to convince some non-believers that include files should
> not include other include files, and that instead they should state
> their dependencies; they want hard data before they commit to such a
> scheme.
>
> Is there some study kicking around that I could point them at rather
> than re-factor our code base and time the resulting builds?  I know
> the plan9 headers largely follow this pattern.
>
> Paul

I think this has more to do with minimising the preprocessor logic. I
like the plan 9 include tree more than the traditional unix include
mess. In my programs I dont use macros anywhere. none. nada. zero.

If one could only get rid of the preprocessor...

-- 
the thing i like with my linux pc is that i can sum up my complaints in 5 items
0
Reply rogelio.serrano (26) 10/23/2006 12:40:25 PM
comp.os.plan9 9256 articles. 1 followers. Post

3 Replies
109 Views

Similar Articles

[PageSpeed] 34


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

Multiple include guards in header files
The stand libary that is a part of my compiler (BC++) has the typical include guards in the header files, but it also wraps the #include of the header in files that use it: // _defs.h // #if !defined(___DEFS_H) #define ___DEFS_H // header stuff here #endif /* ___DEFS_H */ // stdarg.h // #if !defined(___DEFS_H) #include <_defs.h> #endif Is the guard in stdarg.h just to speed up compiles? It sure looks ugly and is a lot of typing to adopt such technique. Ted [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: ...

Multiple INCLUDE Vs multiple USE
hi ! this is a very common problem ...

Multiple INCLUDE Vs multiple USE #2
hi ! sorry for the last post. and I want to say that I searched thoroughly for the answer to my qn b4 posting here. I have multiple subroutines which use a single data structure..and I want to keep all those subroutines in different files. so i am having to USE that data structure in every subroutine.. since they are different files.. i am having to INCLUDE the data structure file as well in all those subroutine files... When i put all these together into the master file... where every subroutine gets called..i naturally get a case of multiple include.. I solved this problem using #ifdef...

Multiple includes with RequestDispatcher
I'm trying to do something portal-like with a servlet. I want to output html from the servlet, and put the content of multiple JSP's as well. My problem is that only one call to request.getOutputStream() is allowed. This is per the spec, and both Tomcat and Websphere will throw an exception: java.lang.IllegalStateException: getOutputStream() has already been called for this response Because RequestDispatcher.include calls getOutputStream, I can only do one include. I also can't combine it with any other input. Is there another way? If I could capture RequestDispatcher output in...

Include Javascript multiple
Hi, Here is my problem : Here is my first HTML file including a js : <script language="JavaScript" src="http://www.toto.com/monjs.js"></script> In my "monjs.js" : document.write('<table cellpadding="0" cellspacing="0" border="1" style="width:250; color: #000000">'); document.write('<tr>'); document.write('<td style="width: 250;">'); document.write("line1"); document.write('</td>'); document.write('</tr>'); document.write...

About preprocessing and include guards
Say you have a file, a.h with an include guard. If you include it twice and look at the preprocessed output, you see there's no sign for the second inclusion. However, if you include it twice - once from a relative path, and once from an absolute one - you see that the second inclusion indeed occurs (enters the file and leaves immediately due to the include guard). Why does this happen (I have my speculations, but I want some reassurance...), and is there any way to make it always act like in the latter case? Thanks, - Tali On Wed, 20 Jun 2007 11:02:29 -0000, gutmant@gmail.com wrote: ...

Prevents multiple includes of the same module
Hello, one module defines several CONSTANTS As it is required from few classes I get warning: already initialized constant FOO How can I prevents the redefinition of theses CONSTANTS ? It's just because it pollutes my screen during unit testing... Thanks Zouplaz wrote: > Hello, one module defines several CONSTANTS > As it is required from few classes I get > warning: already initialized constant FOO > > How can I prevents the redefinition of theses CONSTANTS ? It's just > because it pollutes my screen during unit testing... > > Thanks It's not clear w...

Including multiple files with same name?
I have the following structure in a src folder: A/X A/X/x.h A/X/x.cpp B/X B/X/x.h B/X/x.cpp where A/X/x.h is: #ifndef A_X_H #define A_X_H namespace A { class X { }; } #endif And: where B/X/x.h is: #ifndef B_X_H #define B_X_H namespace B { class X { }; } #endif But how do I include multiple files with the same name? I guess this should be possible since that is the whole point with namespaces (to have multiple types with the same name but located in different namespaces). On May 9, 9:44=A0am, none <"&...

Include guards and inclusion order
Hello group, there are these moments when I just hate C++. This is one of them. So, I've been working on this project for a long time, classes have grown and become quite many, now it's time for the "inclusion fiasco". I've used include guards to protect my header files and always included the necessary includes so my include files are parsed correctly. I.e. I have constructs like Vehicle.hpp: #ifndef VEHICLE_HPP #define VEHICLE_HPP #include <SDL.h> #include "Sound.hpp" #include "Map.hpp" #include "SpriteManager.hpp" class Vehic...

Prosper: How to include Multiple Authors
Hi. In documents using the "article" class, I use the \and command to include multiple authors as it nicely tabulates author names, affiliations, etc, as exemplified below: \author{ John Doe\\ Dept of ABC\\ john.doe@abc.edu \and Jane Doe\\ Dept of XYZ\\ jane.doe@xyz.edu} Are there similiar facilities available in PROSPER? I would like to avoid having to manually link author and contact/affiliation (e.g., by virtue of inserting characters). Sincerely, Kouros "Peace, commerce and honest friendship with all nations; entangling alliances with none." --Thomas Jefferson: ...

Multiple JavaScript includes fail
Has anyone experienced this (and found a solution)? I have five files: a .htm that invokes four .js include files. Only the first alert in the first include is displayed. This only happens when I run on a client's corporate server. I have no problems on a laptop connected to the network or on my home PC. Any ideas? Thanks in advance. <html> <head> <title>test_js.htm</title> </head> <body> <script type="text/javascript" src="test_js.js"></script> <script type="text/javascript" src="test_js.js1"...

[9fans] missing includes for xen3
xen-public in 9/xen3 is empty. building is hard :-) I'm going shopping. Richard, you out there :-) ron > Richard, you out there :-) Sorry, I've been in Madrid. We missed you there. IWP9 was great - many thanks to Nemo, Gorka, Enrique and doubtless many others for hosting it. > xen-public in 9/xen3 is empty. building is hard :-) >From /n/sources/xen/xen3/README (and repeated in the wiki): "... to build a new kernel, copy or bind into /sys/src/9/xen3, copy or bind the xen/include/public directory from the Xen source distribution into /sys/src/9/xen3/xen-public, an...

multiple include using wildcard?
Hello I am looking for ways to programmatically include all XML files from a given directory into either a "summary" XML file or at XSLT stage. The number of XML files (actually representing daily orders) present in the directory will vary. I have been playing with coding using <xi:include> or <xsl:apply-templates select="document(@href)/*"/> but am stumped at how to iterate through the file structure. Any help *much* appreciated.... L leapy wrote: > I am looking for ways to programmatically include all XML files from a > given directory into...

Including Multiple xsql files
hi, I have a 3 separate xsql files which are used with 3 xsql files to generate 3 distinct html pages. A request has been made to provide a print all feature where by all 3 pages are stitched together into one long page - the problem I have is that I don't want to have to copy and paste the xsql content into one and likewise for the xsl. I've tried creating a parent xsql file which uses include-xsql to include the 3 other xsql files but this creates a new root element which breaks the xsl files. Is there a way to do this? Thanks, Phillip ...

Sutters guidelines and redundant include guards
I have just come across the guideline: "Always write internal #include guards. Never write external #include guards." and I have a few comments about it: 1. Sutter's example is not quite correct. The code fragment he gives is for headers that do not have a predictable guard (e.g system headers or third-party headers). When the guard is predictable the construct is (slightly) smaller, e.g: #ifndef INCLUDED_FOOBAR_H #include "foobar.h" #endif 2. Microsoft compilers and other compilers aimed at Windoze machines do indeed make redundant include guards, er, redundant. How...

Including multiple xsl files from a folder
Hi there! I am including several xsl files, as follows: <xsl:include href="folder/file1.xsl"/> <xsl:include href="folder/file2.xsl"/> ... and so on Is there a way to include all the files from a same directory, doing something like that: <xsl:include href="folder/*.xsl"/> This above doesn't work so I need to find another way... Thanks a lot! Julien ...

PHP Session Trouble on Multiple Include
Ok, you all are going to have to bear with me on this one as it is kinda complicated to explain. I am implementing a company management suite that requires Role-Based authentiations (ie. users are in groups and groups have roles). I have one script which is included in EVERY page in the protected area (masterFuncs.php) and it contains function declarations as well as the authentication module kick-off. Here is a snippet from masterFuncs <snip> <? require_once("${includeBase}company/utils/cipher/crypt_class.php"); require_once("${includeBase}company/utils/Adodb/adod...

header file without include guard
Hi, all: What will happen if header files with the exact same names but with different contents and declared/defined without include guard reside in the include path for the compiler? Are these header files are included more than once? If so, is it the lastest included file always overwrite the previous one? Is this behavior predictable? thanks. wenmang@yahoo.com wrote: > What will happen if header files with the exact same names but with > different contents and declared/defined without include guard reside in > the include path for the compiler? Nothing. They just reside there. ...

multiple files using the same include file
I know I am searching using the wrong words because I can't seem to find a simple answer on this. Here's what I want to do. helper.inc <!php var $fileName2; class helper { function funcOne($fileName) { $fp = fopen($fileName,"r"); $fileName2 = $fileName; **do stuff with the file** } function getFileName() { return {$fileName2); } } ?> first.php <html> <?php require('helper.inc'); $helper_first = new helper(); $helper_first->funcOne("info.txt"); ***** Lay...

[9fans] pcc/8c include stuff
i deleted the original message. russ, i can't verify your claim that pcc always seaches . first by experiment. pcc -Iplan9 -I. from the top directory does what was intended. i tested using <inc1.h> and not "inc1.h". the problem was the behavior was not the same when using kenc with the -p option. i did not test my change, but i assume that if you don't pass pcc -I. -Iplan9 and instead pass the command line that worked orignally, it will still work. - erik > i deleted the original message. russ, i can't verify your claim > that cpp always seaches . fir...

[vim] auto generate include guards
The subject says it all. Is there a way to get vim [script/tip] to automatically generate include guards in a empty c/c++ header file? For instance, if I use vim to create a new c/c++ header file, say foo.h, I'd like vim to "automatically" create the following include guards for me: #ifndef FOO_H #define FOO_H #endif /* FOO_H */ TIA, -- A ankurshah@cheerful.com (Ankur) wrote in news:83b4c08c.0405031410.ae940a3 @posting.google.com: > The subject says it all. Is there a way to get vim [script/tip] to > automatically generate include guards in a empty c/c...

[9fans] /sys/include/ape/errno.h
I note that the choice of error numbers, specially those under the heading /* bsd networking software */ is not consistent with BSD. I also miss EWOULDBLOCK and ECONNRESET, although I confess I did not search very far for them, so if they are to be found elsewhere, please point them out to me. What I want to know is whether the choice of errnos has a deeper meaning, or whether I could just replace the values with those from a recent (NetBSD 1.6.1, in my case) *BSD distribution. I imagine I'd have to recompile all the libraries for consistency, at least libap.a? ++L This is a multi-p...

[9fans] /sys/include/ape/u.h
i'm not sure i understand the rationale behind this file. shouldn't these defines be in /$objtype/include/u.h? seems a mistake to make a u.h machine independent. what am i missing? - erik erik quanstrom <quanstro@quanstro.net> said: > i'm not sure i understand the rationale behind this file. > shouldn't these defines be in /$objtype/include/u.h? > seems a mistake to make a u.h machine independent. > what am i missing? I have no idea what you are referring to -- I did not create any files I mentioned... so, for whatever you are missing I ...

Variable scoping
Hi All, Sorry if I'm just repeating other questions, but I can't find an answer for this particular problem: I have my main index.php file, which looks so: <?php include "includes/header.php"; #defines a global variable called $lang include "includes/functions.php"; # some required functions safe_include "main_page.html"; # user-defined function that tries to # include main_page.html.$lang or gives a warning message echo "Language available to index.php at line XYZ is -$lang-"; #-- to check empty value inclu...