View unanswered posts | View active topics It is currently Thu Dec 18, 2014 9:39 am






Reply to topic  [ 4 posts ] 
RobotC 3.51 bug 11 
Author Message
Online
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1359
Post RobotC 3.51 bug 11
I just downloaded Xander's latest driver and when compiling with it, it gave me a warning on hitechnic_irseeker-v2.h:
*Warning*:Comparison between 'signed' and 'unsigned' operands.
I think RobotC doesn't like the comparison of (HTIRS2_I2CReply[iMax - 1] > (HTIRS2_I2CReply[iMax]/2). When you divide HTIRS2_I2CReply[iMax]/2, the compiler converted the unsigned value to signed. So you are comparing a unsigned value with a signed value and hence the warning.
Code:
  // Check signal strength of neighbouring sensor elements
  if ((iMax > 0) && (HTIRS2_I2CReply[iMax - 1] > (HTIRS2_I2CReply[iMax] / 2)))
  {
      dir--;
      dcSigSum += HTIRS2_I2CReply[iMax - 1];
  }

  if ((iMax < 4) && (HTIRS2_I2CReply[iMax + 1] > HTIRS2_I2CReply[iMax] / 2))
  {
      dir++;
      dcSigSum += HTIRS2_I2CReply[iMax + 1];
  }

However, even if I type cast it back to ubyte, the warning does not go away. I think that's a RobotC bug.
I simplified the code to the following to demonstrate the issue.
Code:
task main()
{
    ubyte x = 10;
    ubyte y = 20;

    if ((ubyte)(x/2) > y)
    {
        nxtDisplayTextLine(0, "x/2 > y");
    }
    else
    {
        nxtDisplayTextLine(0, "x/2 <= y");
    }
}


Sun Sep 30, 2012 3:02 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3297
Location: Rotterdam, The Netherlands
Post Re: RobotC 3.51 bug 11
Yeah, I saw that warning, but I couldn't remember if I'd submitted a report to Dick and Tim about it already. It's a non-fatal issue, but it's going to generate questions from users, if left unsolved.

- Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Sun Sep 30, 2012 8:55 am
Profile WWW
Creator
Creator

Joined: Fri Feb 09, 2007 9:21 am
Posts: 615
Post Re: RobotC 3.51 bug 11
I confirmed that there are no error messages in the current development version which will be released soon.


Mon Oct 15, 2012 3:49 pm
Profile
Rookie

Joined: Tue Sep 10, 2013 1:51 am
Posts: 2
Post Re: RobotC 3.51 bug 11
Well thanks for the insight. I'm sure it'll get resolved. Have you tried the LCD does it work? I'll need to try that. thanks for the updating

_________________
http://www.plagiarism-checker.info/
http://en.wikipedia.org/wiki/Plagiarism
http://definitions.uslegal.com/p/plagiarism/
http://www.primark-online.net/


Tue Sep 10, 2013 2:04 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.