Go to Post Water game. - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 31-12-2006, 15:53
chris31 chris31 is offline
Team 2021 Captain
AKA: Chris Davidson
FRC #2021 (FA Robotics)
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2006
Location: Atlanta, GA/ Fredericksburg,VA
Posts: 949
chris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond reputechris31 has a reputation beyond repute
Send a message via AIM to chris31
Re: Number of liines of code in user_routines.c

Yeah under a 1000 isnt bad. Also it has to do with how you code. Theres all sorts of ways to cut number of lines in half without changing anything.

Example

PHP Code:
for(blah){
junk();

instead of

PHP Code:
for(blah)
{
junk();

cuts out 1 line. Its all how you liek to do it.
  #2   Spotlight this post!  
Unread 31-12-2006, 16:08
teh_pwnerer795 teh_pwnerer795 is offline
Registered User
AKA: !!Mitch!!
FRC #1392
Team Role: Programmer
 
Join Date: Nov 2006
Rookie Year: 2006
Location: Ajax, Canada
Posts: 142
teh_pwnerer795 is just really niceteh_pwnerer795 is just really niceteh_pwnerer795 is just really niceteh_pwnerer795 is just really nice
Send a message via MSN to teh_pwnerer795 Send a message via Yahoo to teh_pwnerer795
Re: Number of liines of code in user_routines.c

Quote:
Originally Posted by chris31 View Post
PHP Code:
for(blah)
{
junk();

I mostly do it this way... and i also include all the brackets... even though sometimes you dont have too..
__________________
Great Art is Created; Master Pieces are Stolen

[n00b]Teh_Foxdonut teh_pwnerer795 - CounterStrike:Source
  #3   Spotlight this post!  
Unread 31-12-2006, 16:10
Donut Donut is online now
The Arizona Mentor
AKA: Andrew
FRC #2662 (RoboKrew)
Team Role: Engineer
 
Join Date: Mar 2005
Rookie Year: 2004
Location: Goodyear, AZ
Posts: 1,292
Donut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond reputeDonut has a reputation beyond repute
Re: Number of liines of code in user_routines.c

Yeah, depending on your style of coding and how many comments you actually add, the lines can vary tremendously. What's more important is the actual amount of data space you use. If you're using MPLAB (and I'm assuming you are), go to View->Memory Usage Gauge, and this will tell you both the amount of code and variable space you're using.

We overflowed the 2005 processor trying to get the camera and a driver perspective drive system with a gyro working. Last year we ended up using about 1/5 of the available space.
__________________
FRC Team 498 (Peoria, AZ), Student: 2004 - 2007
FRC Team 498 (Peoria, AZ), Mentor: 2008 - 2011
FRC Team 167 (Iowa City, IA), Mentor: 2012 - 2014
FRC Team 2662 (Tolleson, AZ), Mentor: 2014 - Present
  #4   Spotlight this post!  
Unread 31-12-2006, 16:12
Salik Syed Salik Syed is offline
Registered User
FRC #0701 (RoboVikes)
Team Role: Alumni
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Stanford CA.
Posts: 514
Salik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud of
Send a message via AIM to Salik Syed
Re: Number of liines of code in user_routines.c

So assuming some one uses a very inefficient coding style i.e something like this:
Code:
int values[3];
for(int i =0; i<=2; i ++)
{
    switch i
    case 0:
    values[0] = 0;

    case 1:
    values[1] = 0;

    case 2:
    values[2] = 0;
}
versus:
Code:
for (int i =0; i<=2, i++)
{
     values[i] = 0;
}
The modern compiler should still spit out the same machine code correct?
__________________
Team 701
  #5   Spotlight this post!  
Unread 31-12-2006, 17:05
Cjmovie's Avatar
Cjmovie Cjmovie is offline
1293 Resident Hacker
AKA: Christopher Corsi
FRC #1293 (D5 Robotics)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2006
Location: SC
Posts: 73
Cjmovie is a name known to allCjmovie is a name known to allCjmovie is a name known to allCjmovie is a name known to allCjmovie is a name known to allCjmovie is a name known to all
Re: Number of liines of code in user_routines.c

In an ideal world, yes, the compiler should do about the same thing. However, we're talking about MPLAB's compiler here, and it's far from "ideal". Something tells me even GCC would have difficulty optimizing it. My best bet goes to Intel's super-optimizing compiler. It's too bad we can't have something like that for our PICs.

As for code length in user_routines.c? It's only about 400-500. That's because I split my code up into multiple files. In all, I think I've written about 2000 in the pre-season this year. I've also taken the time to write my own camera code as opposed to Kevin's (it's good, just a little drawn out, IMHO).
__________________
D5 Robotics, Team 1293: Programmer, CAD'er, Mechanical, Electrical... I've made my rounds.
Events: 2006-2009 Palmetto Regional
Website: http://d5robotics.org/

Last edited by Cjmovie : 31-12-2006 at 17:07.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
position of fleid lines Tachion FIRST Tech Challenge 1 05-12-2005 14:36
field lines Tachion FIRST Tech Challenge 0 15-11-2005 15:46
cruise lines robot180 Chit-Chat 9 29-06-2004 22:03
Extruding Lines Jim Giacchi Inventor 7 21-08-2002 17:30


All times are GMT -5. The time now is 01:20.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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