View unanswered posts | View active topics It is currently Sat Oct 25, 2014 8:21 pm






Reply to topic  [ 3 posts ] 
why? *Warning*:Meaningless statement-no code generated 
Author Message
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post why? *Warning*:Meaningless statement-no code generated
hi,
what's wrong with this? maybe I'm blind :shock:

With the following code I get the error message at the for-loop:
Quote:
*Warning*:Meaningless statement -- no code generated

why?? :shock:

and the screen indeed shows "0" instead of "55" (sum of all numbers from 0 to 10) :shock:
Code:
// RobotC 1.45
#define print nxtDisplayTextLine

void test (float x,  int &S)
{
  int i;
  int t=0;

  for (i=0; i++; i<11)  // <<<<<  *Warning*:Meaningless statement -- no code generated
    {t=t+i;}              // sum of all numbers, just for testing!
  S=t;

}


task main()
{
  float x, y;
  int   S, E;

  eraseDisplay();
  S=0;

  x=1; test(x, S); print(5,"%4d", S);   // x has no sence, only for testing

   while (true)
   {

   }
}

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Last edited by Ford Prefect on Sat Oct 25, 2008 7:03 am, edited 1 time in total.



Fri Oct 24, 2008 10:38 am
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3227
Location: Rotterdam, The Netherlands
Post Re: 1.45: why? *Warning*:Meaningless statement-no code generated
Helmut,

That for statement ought to read something like this:
for (i=0; i < 11; i++) <-- now it's a meaning_full_ statement :)

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]


Fri Oct 24, 2008 11:18 am
Profile WWW
Guru
User avatar

Joined: Sat Mar 01, 2008 12:52 pm
Posts: 1030
Post Re: 1.45: why? *Warning*:Meaningless statement-no code generated
oh holy Bill...
yes, surely, thx! Image

_________________
regards,
HaWe aka Ford
#define S sqrt(t+2*i*i)<2
#define F(a,b) for(a=0;a<b;++a)
float x,y,r,i,s,j,t,n;task main(){F(y,64){F(x,99){r=i=t=0;s=x/33-2;j=y/32-1;F(n,50&S){t=r*r-i*i;i=2*r*i+j;r=t+s;}if(S){PutPixel(x,y);}}}while(1)}


Fri Oct 24, 2008 11:41 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.