Go to Post Let me tell you, the scariest day ever was the day that I realized since I am a mentor, people actually take my advice and I should be careful of what kind of advice I give. :ahh: - Elgin Clock [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-05-2010, 22:12
Chris27's Avatar
Chris27 Chris27 is offline
Registered User
AKA: Chris Freeman
FRC #1625 (Winnovation)
Team Role: Alumni
 
Join Date: Mar 2005
Rookie Year: 2004
Location: Mountain View
Posts: 196
Chris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant futureChris27 has a brilliant future
Re: Collaborations and Alliances

As a CS student at CMU, I've always been told that

Code:
if(isSomeCondition == true) { ... }
is horrible style, and this really should be written as
Code:
if(isSomeCondition) { ... }
Code:
if(isSomeCondition = true)
Is "correct" syntax and by itself will not cause a run time error. However this will cause your program to behave incorrectly (for instance the if statement will always evaluate to true) which could definitely lead to a run time error if e.g.

Code:
if(somePtr = NULL) { ... }
else { 
  somePtr->someField = someValue;
}
I assume this is what you meant apalrd?
Reply With Quote
  #2   Spotlight this post!  
Unread 12-05-2010, 22:46
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Collaborations and Alliances

yes, this is what I meant. There will not be a runtime error, but a bug, which is probably harder to track down then the compile error.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
Reply With Quote
  #3   Spotlight this post!  
Unread 13-05-2010, 07:55
Chris Hibner's Avatar Unsung FIRST Hero
Chris Hibner Chris Hibner is offline
Eschewing Obfuscation Since 1990
AKA: Lars Kamen's Roadie
FRC #0051 (Wings of Fire)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1997
Location: Canton, MI
Posts: 1,488
Chris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond repute
Re: Collaborations and Alliances

Quote:
Originally Posted by Chris27 View Post
As a CS student at CMU, I've always been told that

Code:
if(isSomeCondition == true) { ... }
is horrible style, and this really should be written as
Code:
if(isSomeCondition) { ... }
I'm sooooo sorry to drag this thread off topic.

Anyway, coding style is vastly open to many opinions, and you'll find that the "preferred" method changes about as often as the direction of the wind.

The reason I quoted this is because the CMU-defined "horrible style" is required by my current employer. "if (isSomeCondition)" is against the coding standard where I work (but I prefer to do it that way in my own software outside of work).

I guess my point is that anything anyone tells you about software, take it with a grain of salt. One man's trash is another man's treasure, and that applies to software as well.
__________________
-
An ounce of perception is worth a pound of obscure.

Last edited by Chris Hibner : 13-05-2010 at 08:01.
Reply With Quote
Reply


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
Any East Coast Collaborations? Akash Rastogi Team Organization 47 25-06-2008 19:22
Collaborations hayakuneko General Forum 46 29-03-2006 11:37
How to start collaborations with teams? Billfred General Forum 3 22-10-2005 21:24
College/High School Collaborations? Charlie B General Forum 6 06-10-2003 12:05


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

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