wishlist for NXC

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: wishlist for NXC

Post by HaWe »

will it once be possible to initialize arrays like

Code: Select all

  int array[];
  array={0,3,5,2,9};
?
mightor
Site Admin
Posts: 1079
Joined: 25 Sep 2010, 15:02
Location: Rotterdam, Netherlands
Contact:

Re: wishlist for NXC

Post by mightor »

Removed some completely off-topic posts. Please keep this thread uncluttered. There's no lack of other threads that are more suited for banter :)

- Xander
| My Blog: I'd Rather Be Building Robots (http://botbench.com)
| RobotC 3rd Party Driver Suite: (http://rdpartyrobotcdr.sourceforge.net)
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: wishlist for NXC

Post by HaWe »

ok,
so when will the next NXC version be released?
nxtboyiii
Posts: 366
Joined: 02 Oct 2010, 07:08
Location: Everywhere

Re: wishlist for NXC

Post by nxtboyiii »

What about a mod function?
It would return the remainder of the input float.
Like this:

Code: Select all

task main()
{
 int remainder;
  remainder=mod(5.7);
  //remainder should be 0.7
}
Also would it be possible to fill a polygon when creating a 3d shape?
The default would be transparent, because you can see lines behind lines.
The filled would be like this:

Code: Select all

glBeginObject();
glBegin(GL_FILL_POLYGON_WHITE);
glAddVertex(50,45,50);
//other vertexes....
glEnd();
glBegin(GL_FILL_POLYGON_BLACK);
glAddVertex(20,35,10);
//other vertexes....
glEnd();
glEndObject();
Thanks, and have a nice day,
nxtboy III

programnxt.com
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: wishlist for NXC

Post by HaWe »

What about a mod function?
It would return the remainder of the input float.
I guess what you mean is a frac function, not modulo.
Modulo is the integer division remainder, (C function symbol: "%")
what you mean are the numbers behind the decimal point.

In ANSI-C I don't know a frac function (CMIIW), but you can build it by

Code: Select all

inline float frac(float myVal){
  return(myVal-(int)myVal); // (int) = explicite conversion - I'd wish to have it in NXC!!!
}
in NXC you may write

Code: Select all

inline float frac(float myVal){
  int ibuf=myVal;  // implicite conversion
  return(myVal-ibuf);
}
muntoo
Posts: 834
Joined: 01 Oct 2010, 02:54
Location: Your Worst Nightmare
Contact:

Re: wishlist for NXC

Post by muntoo »

doc-helmut wrote:in NXC you may write

Code: Select all

inline float frac(float myVal){
  int ibuf=myVal;  // implicite conversion
  return(myVal-ibuf);
}
OR:

Code: Select all

/*
inline long trunc(float x)
{
    return(x);
}
*/

inline float frac(float x)
{
    return(x - trunc(x));
}
OR EVEN: Because, frac() is already defined in the NXC API.
Image

Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE


Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: wishlist for NXC

Post by HaWe »

oh *surprise* - didn't expect this.
NXCBSMTC...;)
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: wishlist for NXC

Post by HaWe »

could we possibly have a
"fast i2c mode" (i2c Highspeed Mode)
the way e.g. RobotC has got?
Some i2c devices then could be possibly driven at a higher i2c speed with faster i2c calls...!
nxtboyiii
Posts: 366
Joined: 02 Oct 2010, 07:08
Location: Everywhere

Re: wishlist for NXC

Post by nxtboyiii »

Would it be possible to add a double?
for example:

Code: Select all

double x=78.5464325;
Thanks, and have a nice day,
nxtboy III

programnxt.com
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: wishlist for NXC

Post by afanofosc »

Adding support for a double type is not something I foresee ever happening. The existing firmware passes variables around as generic 4 byte types in a lot of places. Since a float is 4 bytes and you can store any of the smaller integer types within the 4 byte LONG used in the firmware then everything works okay. But if you tried to add support for a double which is greater than 4 bytes long then you would have to change all of that code. It would be a lot of work in the firmware and then I would have to do a lot of work in the compiler to handle a new type. Lots of work for not a whole lot of benefit.

John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests