Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Legal to add .c file? (http://www.chiefdelphi.com/forums/showthread.php?t=39986)

Doogie 12-10-2005 03:18

Legal to add .c file?
 
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

Re: Legal to add .c file?
 
Yes it is perfectly legal to do so.

Billfred 12-10-2005 11:16

Re: Legal to add .c file?
 
Quote:

Originally Posted by Bharat Nain
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

Re: Legal to add .c file?
 
...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

Re: Legal to add .c file?
 
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

Re: Legal to add .c file?
 
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

Re: Legal to add .c file?
 
Quote:

Originally Posted by CJO
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

Re: Legal to add .c file?
 
Alright, thanks a lot. :)

CJO 13-10-2005 17:03

Re: Legal to add .c file?
 
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.


All times are GMT -5. The time now is 18:26.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi