f



[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 9252 articles. 1 followers. quanstro (3876) is leader. Post Follow

3 Replies
355 Views

Similar Articles

[PageSpeed] 9

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

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.php i have: This is a test include i get only the line: The above should have been included. I did not enter php mode in the test include file because of the <? and ?> sygnifying i'm already in php mode, but i tried it anyway and that didn't make a difference, either case the file was not included. This was working previously with php4, i know about the global variables not being allowed in php5, has anything else changed in regards to include files? Any suggestions welcome. Thanks. Dave. "Dave" <dmehler26@woh.rr.com> wrote in news:4754438c$0$8683$4c368faf@roadrunner.com: > 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 p...

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 login.php - user.inc.php includes db.inc.php calling "include('..\db.inc.php')" - both login.php and index.php includes user.inc.php - index.php calls "include('include\authentification\user.inc.php')" - login.php calls "include('..\user.inc.php')" I know I could solve this problem by making those the includes absolute instead of relative but I would prefer to let it relative for some developement reason. myApplication actually contains many other files calling "include('..\db.inc.php')" so I don't want to move this file. Our old configuration seems to include child-includes in their parents before including the parent-include in the main file. Now it seems to include parent before include childs. Any one has an idea why it's no more working and what I could do solve this?...

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 include are expected to help fill in the html. This was not happening hence I investigated. To start with, my index.htm file includes a standard.php file. The standard.php file leads with <? die("here I am"); ?> and I still get my index.htm page and no "here I am". I have tried a phpinfo() too, and nothing happens. In my index.htm file I have placed phpinfo and that works... as does the "die()" too. I know my pages are being caught by the php engine because I can call a temp file with .htm or .php and both are rendered as expected by php. The only thing I do know that might be related to this is if some safe mode (php_safe?) was enabled. My standard.php file lives outside my directory tree... I've printed the include statement so that I can confirm the full path and file name to be included is correct... so I know its requesting the include pr...

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

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 authentification (dir) user.inc.php login.php - user.inc.php includes db.inc.php calling "include('..\db.inc.php')" - both login.php and index.php includes user.inc.php - index.php calls "include('include\authentification\user.inc.php')" - login.php calls "include('user.inc.php')" <-- Corrected here I know I could solve this problem by making those the includes absolute instead of relative but I would prefer to let it relative for some developement reason. myApplication actually contains many other files calling "include('..\db.inc.php')" so I don't want to move this file. Our old configuration seems to include child-includes in their parents before including the parent-include in the main file. Now it seems to include parent before inc...

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/local/majordomo/lists/test > >When collecting this into the db, the include is not evaluated - no >include ocurrs. It's not supposed to evaluate at alias-build-time, but at mail-send-time - this is a feature (otherwise the :include: would be quite pointless). --Per Hedeland per@hedeland.org ...

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

Mac OS 9.x included in Mac OS X?
Hi, I read that Mac OS X has a so-called classic mode which emulates Mac OS 9.x so that older applications can still be run. Provided one is not an upgrader from Mac OS 9.x, does Mac OS X include Mac OS 9.x required for the classic mode or does it have to be bought separately? Peter >Provided one is not an upgrader from Mac OS 9.x, does Mac OS X include >Mac OS 9.x required for the classic mode or does it have to be bought >separately? If you buy the installer for OS X it *does not* include OS 9. You generally use the copy of OS 9 that came with your computer in order to install C...

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 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.0.491 / Virus Database: 290 - Release Date: 18/06/2003 Hi there The way you are including now, is that the server will pars this request and thereby giving you the RESULT of the .inc file. If you include with the full pathname (c:\root\to\file.inc) than the source of the inc file is included and not parsed via the server. In this way it's like the source of the inc file was in the source of the php file you include it in. That's what you want. Good Luck. ##-----------------------------------------------## Article posted from PHP Freaks NewsGroups http://www.phpfreaks.com/newsgroups Get Addicted: comp.lang.php ##-----------------------------------------------## "Martijn van Schie" <ma.van.schie_at_wanadoo_dot_nl@foo.com> wrote in message news:4cycnfaQre1Bj4iiXTWQkQ@giganews.com... > Hi there > The way you are including no...

#including
How do I include a php file with arguments in a shtml file? It just gives me an error. Can this be done? In article <2yvNb.5419$HR.11057@news.indigo.ie>, no@no.ie says... > How do I include a php file with arguments in a shtml file? It just gives me > an error. Can this be done? yes if you set the shtml file to parse as a php file. -- ************************************** The Eldritch Dark: Dedicated to Clark Ashton Smith http://www.eldritchdark.com/ "Boyd" <boyd@dont.spam.me> wrote in message news:MPG.1a71b42e6662145b9896a0@news.slingshot.co.nz... > In article <2yvNb.5419$HR.11057@news.indigo.ie>, no@no.ie says... > > How do I include a php file with arguments in a shtml file? It just gives me > > an error. Can this be done? > > yes if you set the shtml file to parse as a php file. > > -- > ************************************** > The Eldritch Dark: > Dedicated to Clark Ashton Smith > http://www.eldritchdark.com/ can you please explain how to do this? It might be easier to rename the file to .php and use the equivalent parts in php rather than .shtml -- Mike Bradley http://www.gzentools.com -- free online php tools "Joe Cybernet" <no@no.ie> wrote in message news:2yvNb.5419$HR.11057@news.indigo.ie... > How do I include a php file with arguments in a shtml file? It just gives me > an error. Can this be done? > > Yeah I dont mind doing that, but if I use the i...

Include
Hi all, is there anyone who knows of a way in VB6 to have include-files (like in C: include <include.h>) ? thanks! Henk On Tue, 14 Oct 2003 22:25:05 +0200, "Henk ten Bos" <henktb_1@xs4all.nl> wrote: >Hi all, > >is there anyone who knows of a way in VB6 to have include-files (like in C: >include <include.h>) ? > >thanks! >Henk Totally unnecessary. If you add a file to a project the normal way (or manually add it to the project file), it's automatically included everywhere. (If you really want, you can always write modules and give them an extension of .bi - that's the old QuickBasic extension for "Basic Include" - but you'll still have to add them in normally.) -- auric "underscore" "underscore" "at" hotmail "dot" com ***** I'd love to, but I left my body in my other clothes. Well.... I do have a valid reason to want some sort of an include file. I'd like to have a number of language dependent constants in my project and (to avoid having to declare them globally) would like to include them using a language-file. Example for the same function using English and Dutch: Public Sub Message() Private Const cText as String = "This is a message" ........ Call MsgBox(cText) End Sub And Public Sub Message() Private Const cText as String = "Dit is een melding" ........ Call MsgBox(cText) End Sub I would like to implement this using: Pub...

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.inc.php'; include $include_path.'wordfilter.inc.php'; include $include_path.'converter.inc.php'; include $include_path.'functions.inc.php'; thanks, JRough wrote: > 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.inc.php'; > include $include_path.&...

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

Re: how to use %INCLUDE to include all macros in a directory
Filename Macros "/ABC/XYZ/Macros" ; Options SASAutos = ( Macros SASAutos ) ; Now you dont have to 5Include them the SASAutos tells SAS to search for teh Macro in the Macro Directory and if it cant find it there look in the Default SAS Autos Directory. Just make sure that your Macro name is in lowercase in both the file that contains the macro and when you call the macro. This will avoid any case sensetivity problems. Toby Dunn If anything simply cannot go wrong, it will anyway. Murphys Law #2. The buddy system is essential to your survival; it gives the enemy somebody e...

#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? With #include, you add the included code to the scope, right? Any (normal) module you have in an Access database automatically has project scope. That counts as Public. -- Bas Cost Budde http://www.heuveltop.org/BasCB but the domain is nl Gal merom, #include tells your compiler to include that source file in its compile pass. The closest you'll get in VB is Tools | References where you can include type libraries in a project. It's a menu item in the VB/VBA editor window. "Gal merom" <galme@towersemi.com> wrote in message news:4031d7d0$0$196$75868355@news.frii.net... > > 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! ...

#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, 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 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 How? Is there any functions in PHP which do this? ...

About %include
Hi,there I try to understand %include more.I wonder whether the external file %include will execute must be a complete program,that means start from "data" or "proc" statement. for example,can i write this on external file: input x y month $; datalines; 1 1 January 2 2 February 3 3 March 4 4 April ; and then ,run on the sas like: data monthly; %include 'd:\temp\myfile.txt'; run; William, That should work. The include file can be almost anything. A faster way to get answers to this type of question would be to just try it and see what happens. If the result...

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 Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.580 / Virus Database: 367 - Release Date: 06/02/2004 No need to write anything. I found the OB functions etc. Very useful. Thanks. "Mark Jerzykowski" <markjerz2@hotmail.com> wrote in message news:c0hbij$p2v$1@news.ox.ac.uk... > 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 ...

include()
I don't completely understand the documentation for the include() function: "Files for including are first looked in include_path relative to the current working directory and then in include_path relative to the directory of current script. E.g. if your include_path is ., current working directory is /www/, you included include/a.php and there is include "b.php" in that file, b.php is first looked in /www/ and then in /www/include/. " How do you know where "the current working directory" is? Mike wrote: > How do you know where "the current working directory" is? If you mean, how do you find out programmatically what it is, use the getcwd() function. If you mean, how do you as a programmer know what it should be ahead of time, it's usually the directory containing the top-level script that's being executed. (This may not hold true for command-line execution, but should for web execution.) So if the web server is loading up A.php, and A.php include()s B.php, in B.php the working directory is still the location of A.php. (Unless of course you've used chdir() to change it.) -- brion vibber (brion @ pobox.com) "Mike" <mikeotown@nospam.msn.com> wrote in message news:adp0d.43941$Np2.9426@bignews4.bellsouth.net... >I don't completely understand the documentation for the include() function: > > "Files for including are first looked in include_path relative to the > curr...

Web resources about - [9fans] Include guards and multiple includes - comp.os.plan9

Code division multiple access - Wikipedia, the free encyclopedia
Code division multiple access ( CDMA ) is a channel access method used by various radio communication technologies. It should not be confused ...

Brussels terrorist attacks: Multiple blasts rock airport and Maalbeek metro station
Multiple explosions have been reported at separate sites in Brussels on Tuesday morning (local time).

Brussels terrorist attacks: Multiple blasts rock airport and Maalbeek metro station
Multiple explosions have been reported at separate sites in Brussels on Tuesday morning (local time).

Five-car pile-up leaves multiple people in hospital
Five people were taken to hospital&nbsp;following a five car pile up in Canley Vale in Sydney's west on Thursday.

Brussels terrorist attacks: Multiple blasts rock airport and Maalbeek metro station
Multiple explosions have been reported at separate sites in Brussels on Tuesday morning (local time).

Medical examiner: Katy teen died from multiple gunshot wounds - abc13.com
Authorities say they have identified the body found in west Houston earlier this week as missing Katy teenager Adriana Coronado.

Belgian ministers acknowledge multiple security mistakes
The attacks in Brussels have exposed missteps by European security officials and police, just four months after the Islamic State's assault on ...

Choetech 6 port USB charger: The quick way to charge multiple devices
Having multiple mobile devices is great. Charging them? Not so much. If you need to top the battery on a few smartphones and tablets at the same ...

Terror attacks hit Belgium: Multiple explosions at Brussels airport and metro
A new wave of terrorist attacks has hit Europe, following the incidents in Ankara, Turkey. A series of explosions shocked the Brussels airport ...

Leonardo Di Caprio’s Galaxia App Encourages Having Multiple Personalities
... anything posted in that group stays in that group, and can’t be seen by those outside of it. On top of that, Galaxia users can create multiple ...

Resources last updated: 3/26/2016 8:38:58 AM