
09-03-2004, 13:38
|
 |
Fold em oval!
 FRC #1257 (Parallel Universe)
Team Role: College Student
|
|
Join Date: Jan 2004
Rookie Year: 2004
Location: Scotch Plains, NJ
Posts: 1,026
|
|
|
Re: Do you write functions for your code?
Quote:
|
Originally Posted by KenWittlief
actaully, the SW we are creating for these machines is realtime embedded code
remember that the C compiler will convert your code into assembly code, and from that into machine code
breaking your code up into many little functions makes it look nice, but it actually takes longer for it to run, and takes up more code space, because the function calls are actully jumps in assembly code
its shorter and faster to have sequential code all in one routine that simply falls through to the next statement.
not that we really have to be concerned with optimizing our code for size or speed.
well wait, I have seen some people posting that they have used up all the available code space this year - so maybe some of us got a little carried away with the functions :^)
|
Im not sure, but don't good compilers make using functions not so ineffecient? If not, can't you just use inline to get the same effect as not using functions?
__________________
Learn, edit, inspire: The FIRSTwiki.
Team 1257
2005 NYC Regional - 2nd seed, Xerox Creativity Award, Autodesk Visualization Award
2005 Chesapeake Regional - Engineering Inspiration Award
2004 Chesapeake Regional - Rookie Inspiration award
2004 NJ Regional - Team Spirit Award
|