[9fans] Include guards and multiple includes

-----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
plalonde (269)
10/20/2006 6:48:58 PM
comp.os.plan9 9256 articles. 1 followers. quanstro (3876) is leader. Post Follow

3 Replies
185 Views

Similar Articles

[PageSpeed] 48
> 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
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
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
10/23/2006 12:40:25 PM
Reply:
Similar Artilces:

[9fans] Include guards and multiple includes
-----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 0QcMNw3...

include files not being included
Hello, I'm running php 5.2.5 installed from ports on a FreeBSD machine with apache2 as the webserver. I've got php set up properly, but it doesn't include include files. If i do a phpinfo() in a file that works telling me php file processing is working fine. Yet if i have something like for an example: <html> <head> <title>Test of includes</title> </head> <body> <h1><? include "test-include.php"; ?></h1> <p>The above should have been included.</p> </body> </html> and in test-include.ph...

Includes and sub-includes
Hello all, We are currently changing our web server and, in the process, updating PHP version from 4.3.0 to 4.3.5. The problem we've got is that our way to include some files in other ones is no more working properly. The message we are getting looks like: "PHP Warning: main(..\db.inc.php): failed to open stream: No such file or directory in ..." Say we have this file structure: myApplication (dir) index.php include (dir) db.inc.php authentification (dir) user.inc.php ...

include failing to include...
Folks, I have a virtual server with an ISP and I had a web based application available for a customer to try out - it worked fine up until three weeks ago - nothing has changed since then (I am the only one with root password unless the ISP took control without my permission but I'd doubt this). I have Virtual (Named) Hosting enabled and I can test it via individual url's responding appropriately. On one specific URL I have an include as the first line... and there are no error messages in the error log file, the html is rendered just fine but various variables defined during the inc...

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: ...

/* #include <someyhing.h> */ => include it or do not include it? That is the question ....
Hi all, I stumbled on the following example: /* #include <something.h> #include <even_more.h> */ gpp expands the #include statements. I'm not really sure how to interpret this correctly. As I got this like written above, I suppose it is working on an other platform. However, I have found nothing in 6.4.9, 6.4.7 (however R3 mentions an undefined behavior if /* is between the braces or double quotes of the include directive) or 6.10 and I am getting to the conclusion that this is an undefined behavior. Is my assumption right? best regards, Andreas Andreas Bogenberger &...

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

RDOC: including from an included file?
I _can_ use the :include: directive in a file that has been included, can't I? I'm trying to include a Ruby program in a file that is referenced by an :include: directive from my main file. Rdoc doesn't seem to recognize the 2nd :include: directive and simply copies the directive into the output HTML. On Oct 31, 2004, at 15:48, Tim Hunter wrote: > I _can_ use the :include: directive in a file that has been included, > can't > I? I'm trying to include a Ruby program in a file that is referenced by > an :include: directive from my main file. Rdoc doesn't s...

Including a module in an included module.
module M1; end module M2; include M1; end module M1; DOG = :woof; end module M2; DOG; end # => :woof I can add to a module after it has been included. Neat. module M1; DOG = :woof; end module M2; include M1; end module M3; include M2; end module M3; DOG; end # => :woof Including a module seems to give me any modules that it includes. Swish. module M2; end module M3; include M2; end module M1; DOG = :woof; end module M2; include M1; end module M3; DOG; end # => NameError: uninitialized constant M3::DOG So I assumed I&...

Include and sub-includes (correction)
Oups! I did a typing error in my last post. Fixed. ----------- Hello all, We are currently changing our web server and, in the process, updating PHP version from 4.3.0 to 4.3.5. The problem we've got is that our way to include some files in other ones is no more working properly. The message we are getting looks like: "PHP Warning: main(..\db.inc.php): failed to open stream: No such file or directory in ..." Say we have this file structure: myApplication (dir) index.php include (dir) db.inc.php authentifi...

#include headers that include this header
Suppose I have classes Foo and Bar. They depend on each other, but other classes also depend on them. Moreover, their functionality is distinct. How can I include both of them? Specifically, Foo is a class that holds pointers to a variety of objects, as in: class Foo { public: ... private: Bar a Baz b FooBar c } So, I include the headers for Bar, Baz, and FooBar like so: //Foo.hh #ifndef _FOO_HH_ #define _FOO_HH_ 1 #include "Bar.hh" #include "Baz.hh" #include "FooBar.hh" .... //class defn. #endif But the class bar needs a pointer to the Foo object tha...

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...

newaliases 'include' not including
I'm running majordomo. There is a list of addresses, called 'test', in /usr/local/majordomo/lists In /etc/mail/aliases is the line: test-list: :include:/usr/local/majordomo/lists/test When collecting this into the db, the include is not evaluated - no include ocurrs. Any ideas? Gene In article <rt9hfvkmcjfc27gbklodo79eqrt4r76unj@4ax.com> na@na.com writes: > >I'm running majordomo. There is a list of addresses, called 'test', in >/usr/local/majordomo/lists > >In /etc/mail/aliases is the line: > >test-list: :include:/usr/loca...

Include file to include initialize vecters?
Hi all, I write a m-file including hundreds of vecter initialization(using zeros). Is there some file like C language's include file to include the vecter declearation? Thanks! Davy "Davy" <zhushenli@gmail.com> wrote in message news:1118635862.244726.303670@g43g2000cwa.googlegroups.com... > Hi all, > I write a m-file including hundreds of vecter initialization(using > zeros). > Is there some file like C language's include file to include the vecter > declearation? If the M-file containing the vector initializations is a script, just call it at the ...

how to use %INCLUDE to include all macros in a directory
hi, i am wondering if its possible to use %INCLUDE to include all my macros in a certain directory. at the moment i have an %INCLUDE statement per sas file....which is not good programmically... if anyone can help please.... ...

#include
What is the VB equivalnt of #include (in C)? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! Ctrl+C, Ctrl+V <g> Sorry - there is no equivalent. On 17 Feb 2004 08:58:56 GMT, Gal merom <galme@towersemi.com> wrote: > >What is the VB equivalnt of #include (in C)? > > >*** Sent via Developersdex http://www.developersdex.com *** >Don't just participate in USENET...get rewarded for it! Gal merom wrote: > What is the VB equivalnt of #include (in C)? > What is it supposed to do? ...

include
I have a php file which include() 's a file with variables, and a file with functions. so: <? include("../data/common.inc") ?> <? include("../data/functions.inc") ?> if in the php file i then call a function from the functions file, the function doesn't see what values the variables in common.inc are, although the php file does see the variable values. Is there a way of getting round this or is something just going really wrong? Thanks. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6...

#include
I have a program with four class header files. When I #include any .h files into my .cxx (with main()), I get many errors. Can anyone tell me their order? Here's my code: // this is the executable program with main() #include <iostream> #include <fstream> #include <string> //#include "Ta.h" //#include "Student.h" #include "Bronco.h" //*** here is where problems stem from *** //#include "Teacher.h" using namespace std; //bool operator ==(const TA &ta1, const TA &ta2); void Input(); int main() { TA ta1(); TA ta2...

how to do an include
I want to organize my code. I have some in-line functions on a page. I take them all out and put them all on one page called functions.php. To call the page I put the include at the top of the page along with the other includes? I'm not sure but I guess that the .inc. is a directory? So my functions are the last include. I am assuming this is right. include './includes/config.inc.php'; include $include_path.'dates.inc.php'; include $include_path.'auction_types.inc.php'; include $include_path.'countries.inc.php'; include $include_path.'datacheck.in...

===, include?, =~
I started this post after wondering why Set doesn't alias :=== to :include? That led me to look at ===, include?, and =~ for a variety of classes... The following table shows the results of executing pattern.send(method, arg) Pattern Arg === include? =~ /foo/ "foo" yes fails yes 0..10 5 yes yes Object#=~ ["foo"] "foo" Array#== yes Object#=~ Set.new ["foo"] "foo" Set#== yes Object#=~ {"foo", nil} "foo"...

include?
I want to send an email using the mail command. I would like the message parameter to be the contents of a text file. However, I want the text file to use variables from within the program. If I use join("", file($file_name)) the text file isn't evaluated ( $var is printed as $var, not the contents of the variable). If I use $message = include($file_name) I get $message = 1 and the text file is output to the browser. I believe there might be some way around this using %% perhaps. I can't remember exactly. Thanks for the ongoing help. --- Outgoing mail is certified Virus ...

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, but other
What I want to do is: execute script no.1 on server no.1 in this script i need to use some function which will execute script no.2 on server no.2 and then return variables created in this script. why i need to do this? both servers have MySQL servers which are set as localhost (both). in script no.2 on server no.2 I want to execute query which take some data and then I need to use that data in script no.1 Chris Kujawski > What I want to do is: > > execute script no.1 on server no.1 in this script i need to use some > function which will execute script no.2 on server no.2 and...

#include
Hello Everybody, I have a main program and I would like to include another program (MN.h) inside my main program. I already know how to use "extern" for the variables that I have defined as int, double ... in my main program to use the information of my main program in the program that I want to include in my main program however I have some variables that I have used "#define" in my main program but I don't know how I should use extern for the variable which I have used "#define" for them. For example in the follwing main program I know how to use extern to ...

include within include, using a relatve path
Hi, I have noticed something in PHP's include mechanism that surprised me. If you include a script that itself contains an include command using a relative path, that path is interpreted from the position of the 'outermost' script, not that of the script in which the relative path appears. Here is a simplified example, with error checking, php tags etc. left out for clarity. I'll use the extension ".inc.php" to mark scripts that are intended to be included. Let x be the full path to some point in the file system, and imagine that the server has been configured so th...