Go to Post Here we go again with all kinds of speculation. We can never out guess FIRST. - BobC [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Spotlight this post!  
Unread 14-10-2004, 14:43
Ian W. Ian W. is offline
College? What?
no team (Gompei and the Herd)
Team Role: College Student
 
Join Date: Jan 2002
Rookie Year: 2002
Location: Worcester, MA | Smithtown, NY
Posts: 1,464
Ian W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to allIan W. is a name known to all
Send a message via AIM to Ian W.
Re: i would like your opinion on my programs

Quote:
Originally Posted by Ryan Morehart
In C, you have to declare all local variables at the beginning of the function. No other executed line can come before them; comments are fine, but no function calls or anything. C++ relaxes this rule, so if you're actually using a C++ compiler, it will let you get away with not having declarations at the beginning. Be warned though; the MPLAB compiler only accepts at the beginning.
In general though, it's a good habit to declare anything and everything you'll possibly need for the function in the first lines of the function, rather than spread out amongst the random executed lines. It makes the code so much easier to read ;-). Plus, as Ryan said, it's the way to do it in C, and since the robots are all programmed in C (and I don't ever see that changing, because C has been around for quite some time...).

Also, I'm not 100% certain, but I believe it's faster if all your code is C, instead of C++ (this comes from extremely limited programming for Palm IIIs), but someone would have to confirm this, because I can't really remember the reasons or anything.
__________________
AIM --> Woloi
Email --> ian@woloschin.com
 


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
dash programs suneel112 Programming 12 26-01-2005 14:44
IFI's Serial Programs Doing Funny Stuff? Ian W. Programming 4 18-03-2004 21:43
Whats your honest opinion? Sean General Forum 50 17-04-2003 21:05
Dashboard programs and the char variable Ian W. Programming 13 26-06-2002 02:07
Dashboard programs archiver 2000 6 23-06-2002 23:10


All times are GMT -5. The time now is 05:25.

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