[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
138 Views

Similar Articles

[PageSpeed] 25


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

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

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

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

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

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

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

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

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

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

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

include
Hi, is the Ruby-'include' equal to a C++-'using' statement? Meant for namespace issues. Or does it have a bigger result? Thanks, Alex. Selon Alexander Fleck <Fleck@schleissheimer.de>: > Hi, > is the Ruby-'include' equal to a C++-'using' statement? Meant for names= pace > issues. Or does it have a bigger result? > Thanks, > Alex. > "include" is used to mix in a module into a class. It has nothing to do w= ith namespaces, but is rather a way to quickly add functionality to a class b= eyond what is given by its superclass witho...

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

include
During compilation of some software I made, I encounterd the following behaviour. I downloaded mysql.4.0.2.tar.gz untarred it, configured it for use on /usr/local, so I could use it and also continue to use mysql.3.23 which was installed by redhat on my system compiled it installed it Now I made some software, to read from mysql database. This software was compiled with gcc -I/usr/local/mysql/include -I. mysource.c This compiled ok and ran ok until... There was a small difference in mysql-3.23.0 en mysql-4.0.2 And the compiler although I specified an extra include path looked in /usr/inclu...

===, 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
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
I was wondering if i can include some .ch file in all my files with one command. I made a copy of std.ch (part of it) for my needs, and now if i want to use some command from it i need to include it in all my files otherwise clipper use the default command from std.ch. Thanks, and Marry Christmas to all! Hi, clipper yourprog.prg /uyourstd.ch ... no space between /u and the name of your std.ch (works with any ch file) or between /u and the full fils spec of yourstd.ch note that at the same time this disables std.ch from being loaded by the preprocessor; iow, make sure yourstd.ch lists all...

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