Log in

View Full Version : Legal to add .c file?


Doogie
12-10-2005, 03:18
Would it be legal to add a .c file to the code which contains functions that could be called by the autonomous AND user routines?

Bharat Nain
12-10-2005, 05:45
Yes it is perfectly legal to do so.

Billfred
12-10-2005, 11:16
Yes it is perfectly legal to do so.
<insert standard disclaimer here that it may change for 2006, so make sure to read the manual after Kickoff. but I'd imagine it's a relatively safe bet.>

EricS-Team180
12-10-2005, 12:56
...yes, it should work just fine. We do it all the time.

On a side note:
For good programming practice, you'll want to put the function prototypes of your functions into a .h file of the same name. Then #include the .h file at the top of the other files that you want to use the functions in.

Rickertsen2
12-10-2005, 20:14
Absolutely. Basically, you can do anyhting you want as far as code is concerned. There is nothing that is restricted. The hardware is designed such that there is no way you can screw up code in a way that would cause the E-Stop, team numbers etc to stop working.

CJO
12-10-2005, 23:27
In fact, (although not the best of programming practices) you can just create an .h file called "include.h," and put all of your other includes in it, and then just include "include.h" in your c files.

The drawback is that every file includes every header, which may not always be desirable, HOWEVER, for beginning programmers, this can simplify the process of "which files do I need to include?"

Dave Flowerday
13-10-2005, 01:13
In fact, (although not the best of programming practices) you can just create an .h file called "include.h," and put all of your other includes in it, and then just include "include.h" in your c files.

The drawback is that every file includes every header, which may not always be desirable, HOWEVER, for beginning programmers, this can simplify the process of "which files do I need to include?"
Many software people consider this to be a very bad practice, and as such I don't advise it, especially for beginning programmers. No sense in starting off by picking up a bad habit.

Doogie
13-10-2005, 01:40
Alright, thanks a lot. :)

CJO
13-10-2005, 17:03
It depends on the scope of your program. while I would never use it in a major project, the smaller PIC programs lend themselves to centralizaiton of some things, and it can really simplify the process.