Path: utzoo!mnetor!uunet!husc6!bloom-beacon!newman@athena.mit.edu
From: newman@athena.mit.edu (Ron Newman)
Newsgroups: comp.lang.c
Subject: Making re-#includes harmless--a simple solution?
Message-ID: <2000@bloom-beacon.MIT.EDU>
Date: 10 Dec 87 00:40:14 GMT
Sender: daemon@bloom-beacon.MIT.EDU
Reply-To: newman@athena.mit.edu (Ron Newman)
Organization: Massachusetts Institute of Technology
Lines: 22

Many header files begin with something like

  #ifndef  __SOME_UNUSUAL_NAME__
  #define  __SOME_UNUSUAL_NAME__

and end with

  #endif

so that if you #include the file more than once, nothing bad happens.

Why not change the semantics of "#include" to be:  "if, while
processing the current .c source file, I have already included this
file once, then don't include it again"?

That seems a lot cleaner than having to (remember to) put the #ifndef
stuff into every header file.  It would also eliminate problems with
vendors who forget to do this to their standard header files.
Is it too late to fix this for ANSI C??

/Ron Newman
 MIT Project Athena