To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.nxtOpen lugnet.robotics.nxt in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / NXT / 745
744  |  746
Subject: 
RE: NXC - embedded functions failed
Newsgroups: 
lugnet.robotics.nxt
Date: 
Mon, 21 May 2007 23:10:02 GMT
Viewed: 
22222 times
  
Hi John,

Will throwing in a compilation error be a viable option?

--Elizabeth


-----Original Message-----
From: news-gateway@lugnet.com [mailto:news-gateway@lugnet.com] On Behalf Of
Elizabeth Mabrey
Sent: Sunday, May 20, 2007 1:19 PM
To: lugnet.robotics.nxt@lugnet.com
Subject: NXC - embedded functions failed

#include "NXCDefs.h"



int Max(int a,int b){

    if (a>b)

       return a;

    else

       return b;

}



task main(){

         int Prob=0;

         Prob = Max(33, Max(5,15));

         NumOut(5,LCD_LINE2,false,Prob);  //returns 15  WRONG

---------------------------------

         Prob = Max(5,15);

         Prob = Max(33,Prob);

         NumOut(5,LCD_LINE3,false,Prob);  // returns 33  GOOD

---------------------------------

    Wait(10000);

}









--
MIME ATTACHMENTS DISCARDED:

1.  Content-Type: text/html;
    charset="us-ascii"
    Content-Transfer-Encoding: quoted-printable
    Content-Length: 4672



Message has 1 Reply:
  Re: NXC - embedded functions failed
 
(...) I think having NXC generate a compiler error is a great idea. :-) I will work that into the next beta release (b30). I just released beta 29 today. It has a number of important fixes and enhancements but I just noticed that it has a few new (...) (17 years ago, 22-May-07, to lugnet.robotics.nxt)

Message is in Reply To:
  NXC - embedded functions failed
 
#include "NXCDefs.h" int Max(int a,int b){ if (a>b) return a; else return b; } task main(){ int Prob=0; Prob = Max(33, Max(5,15)); NumOut(5,LCD_LINE2,false,Prob); //returns 15 WRONG ---...--- Prob = Max(5,15); Prob = Max(33,Prob); (...) (17 years ago, 20-May-07, to lugnet.robotics.nxt)

4 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR