View unanswered posts | View active topics It is currently Thu Apr 24, 2014 7:03 am






Reply to topic  [ 3 posts ] 
& warning on const 
Author Message
Expert

Joined: Tue Feb 28, 2012 3:10 pm
Posts: 195
Post & warning on const
just a warning, which maybe was the intent (the code seems to run ok)

Code:
   const int type = 2;
   const char reserved[2] = {0x00, 0x00};

   if (!_setup)
      _Private_Datalog_Setup();

   nxtWriteRawHS(dle_stx, 2);
   wait1Msec(1);

   nxtWriteRawHS(&type, 2);


Warning*:Possible illegal unary '&' operator. Operand is a numeric constant!

maybe a bit too cautious??

_________________
Mike aka Spiked3
http://www.spiked3.com


Mon Oct 22, 2012 6:37 pm
Profile
Moderator
Moderator
User avatar

Joined: Tue Sep 14, 2010 9:19 pm
Posts: 496
Post Re: & warning on const
Eh, I assume it's just warning you not to try and change it's value in the function. I don't normally mind the warnings since they're descriptive and unobtrusive (usually). They help solve some common beginner problems as well. You can turn off specific of the warnings in preferences, but I don't know if there is a -w flag.

_________________
sudo rm -rf /


Mon Oct 22, 2012 8:21 pm
Profile
Expert

Joined: Tue Feb 28, 2012 3:10 pm
Posts: 195
Post Re: & warning on const
Well the underlying message is that it treated it as an AND. The code still works as (nothing) AND an assumed address - but may lead to other problems in other ways if that is not the intention.

I suspect it is an unintended compiler parser result. Just thought I'd give the team a heads up, either way.

edit: I see address of is indeed a unary operator - I never thought of it as such - but ok, never mind.

_________________
Mike aka Spiked3
http://www.spiked3.com


Tue Oct 23, 2012 12:38 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


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.