Go to Post Dean's probably sitting in his chair saying "Dance puppets, dance!" - [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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 04-02-2015, 22:42
cstelter cstelter is offline
Programming Mentor
AKA: Craig Stelter
FRC #3018 (Nordic Storm)
Team Role: Mentor
 
Join Date: Apr 2012
Rookie Year: 2012
Location: Mankato, MN
Posts: 77
cstelter will become famous soon enough
Re: Limit Swtich Help

Quote:
Originally Posted by mmaunu View Post
Ether: I have learned so much from reading your posts and papers over the years. I didn't intend to sound like I was correcting your post but merely adding explicit context for other readers.
I for one appreciated the post. As a C/C++ guy who only recently has been using java (and only WRT FRC), I would have expected

Code:
int x=0;
if(x=8)
{
}
to compile fine. I didn't realize the if statement was strongly typed to boolean in java (kind of would have expected it to be overloaded to many types or that there may be some sort of implicit conversion of int to boolean that would happen transparently.)

Of course had I tried to code it, eclipse/netbeans/whatever would have let me know I was wrong long before I tried compile.

Reminds me of the most 'duh' moment I ever had that IDE's don't tend to flag for us yet. I had coded something along the lines of

int x=0;
...
if(x==4 && something_else==2 && something_else==some_other_thing);
{
//some stuff to do
}

It took me the longest time to figure out why I kept entering the if clause even though I was nearly 100% certain that x was *not* 4 and thus the hypothesis should evaluate to false. Finally I put in a sanity check to print x and confirmed that I was right (x was not 4 and the full expression for the if evaluated to false). Only then was I able to see the error of my ways...

sorry to send this slightly off topic.... I did appreciate the points made thoug.
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


All times are GMT -5. The time now is 11:13.

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