On Mon, Jan 25, 2010 at 2:37 PM, Jimmy Johnson <[email protected]> wrote: >> >> > If the file is only "processed once" then what is the point? It seems to >> > make no difference in my code. >> >> The point is if the file /is/ included more than once, the guards >> ensure the contents of it is only processed once. >> > The directive #include <glut.h> occurs multiple times for my system, but I > don't know if the compiler is smart enough to only "include" it once.
It is. > It appears to work without the guards; that's all I'm saying. Otherwise, > wouldn't I have to bracket every #include inside a guard? That would be > tedious. >From a random search, it would appear glut.h does have the guards - you don't have to worry about them (i.e. you don't need to put them in *your* code that's using it.) Lines, 1, 2 and 716 in <http://www.dougtheslug.ca/~cmpt466/doxygen/glut_8h-source.html> To belabor the point, you do not personally have to use any #ifdef statements that include the __glut_h__ token; simply use #include <glut.h> wherever it's needed; your compiler will take care of the rest. The guards go in the header files, not the source files that include the header files. -- PJH http://shabbleland.myminicity.com/ http://www.chavgangs.com/register.php?referer=9375 http://www.kongregate.com/?referrer=Shabble
