View Single Post
  #9   Spotlight this post!  
Unread 15-02-2006, 10:50
aaeamdar's Avatar
aaeamdar aaeamdar is offline
Post-A-Holic
AKA: Paul Dennis
FRC #1719 (The Umbrella Corp)
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Baltimore, MD
Posts: 231
aaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant futureaaeamdar has a brilliant future
Re: A few simple programming questions;

Quote:
Originally Posted by Mark McLeod
I see you have an unmatched bracket here that will give you the syntax error.
Code:
if(p3_sw_trig)
	 {
My main suggestion would be to change how you are commenting out lines and blocks of code.
Switch over to the // form rather than use the /* */ form.
Your blocks are ending in random places.
You're absolutely right, Mark. The problem is that the code is poorly written. IE, the original code that they gave us. Whoever writes the code apparently hasn't come to the realization that C++ style comments (//like this) are available in C now. It used to be that /*this*/ was all there was. However, it's bad coding practice to write one liners like this:
Code:
complicatedMethod(); /*Some comment here*/
Because if you want to block comment that line and a bunch of other like it, you will not be able to easily because the */ at the end will also end yours! The easiest way I have found around this without bothering to change the code (i.e. change /**/ to //) is to use this:

Code:
#if 0
complicatedMethod1(); /*Some comment here*/
complicatedMethod2(); /*Some comment here*/
complicatedMethod3(); /*Some comment here*/
#endif
Alright, that's all for now folks. I think cruella wants to make a coat out of my posts.

Paul Dennis