RF_Developer
Joined: 07 Feb 2011 Posts: 839
|
|
Posted: Tue Jan 31, 2012 4:59 am |
|
|
It's more conventional to name include files simply and set the project options search paths to the relevant locations on your directory structure. The problem is a) readability, long path names or even path names at all, are not easily readable and b) portability: paths change depending on where the project is located and where its compiled, therefore paths usually go in the IDEs project options, not in your code.
Library code, drivers for your favourite I2C and SPI peripheral ICs can go in a library directory somewhere handy, e.g. on a network drive, while your own project specific code generally sits in a single directory, maybe with subdirectories in some complex projects.
In general for readability and portability I try to keep it simple. If I see something like:
Code: |
#include "somedata.h"
#include "somechip.c"
#include "usb.c"
#include "somecode.c"
|
I feel a lot happier compared to facing:
Code: |
#include "c:\\blah\blah\somestrangecode\somedata.h"
#include ""c:\\blah\blah\blah\oldcodereused\somechip.c"
#include "z:\\stuff\directory\whatever\usb.c"
#include "..\..\someplace\wherever\somecode.c"
|
Also unfortunately the CCS pre-processing doesn't do macro substitutions inside some macros. Most C pre-processors do, and should, but the CCS one doesn't in many cases. Within strings being just one of those cases.
RF Developer |
|