Page 4 of 25

Re: wishlist for NXC

Posted: 08 Dec 2010, 22:08
by HaWe
will it once be possible to initialize arrays like

Code: Select all

  int array[];
  array={0,3,5,2,9};
?

Re: wishlist for NXC

Posted: 26 Dec 2010, 08:05
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

Re: wishlist for NXC

Posted: 27 Dec 2010, 19:11
by HaWe
ok,
so when will the next NXC version be released?

Re: wishlist for NXC

Posted: 28 Dec 2010, 16:19
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();

Re: wishlist for NXC

Posted: 28 Dec 2010, 17:21
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);
}

Re: wishlist for NXC

Posted: 30 Dec 2010, 06:10
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.

Re: wishlist for NXC

Posted: 30 Dec 2010, 08:45
by HaWe
oh *surprise* - didn't expect this.
NXCBSMTC...;)

Re: wishlist for NXC

Posted: 01 Jan 2011, 18:48
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...!

Re: wishlist for NXC

Posted: 11 Jan 2011, 16:51
by nxtboyiii
Would it be possible to add a double?
for example:

Code: Select all

double x=78.5464325;

Re: wishlist for NXC

Posted: 11 Jan 2011, 17:28
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