« Return to Thread: MPLAB Pre-processor

Re: MPLAB Pre-processor

by Olin Lathrop :: Rate this Message:

Reply to Author | View in Thread

Justin Richards wrote:
> I discovered that there was a circular reference ie a .h file
> referred to a .h file that included the first .h file.

That's why you often see interlocks on include files.  Each include file
defines a symbol derived from the name of the file.  A IFDEF is used around
the entire file contents to prevent it being read if the symbol is already
defined, meaning that file was already processed.  The special symbol is
then defined inside the IFDEF.

Personally I don't like this method.  Include files shouldn't include other
include files.  The dependencies should be published and the caller should
include the necessary files.  That allows substitution of different
libraries with the same interface at the program level.


********************************************************************
Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products
(978) 742-9014.  Gold level PIC consultants since 2000.
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

 « Return to Thread: MPLAB Pre-processor