wishlist for NXC
Re: wishlist for NXC
what about overloading functions?
All function-types-problems and different-number-of-parameters-problems could be resolved.
ok, I admit: this is not ANSI C 99 - but C++ like...
it might get us 1 step closer to ACDC++
;)
examples: printf could work with unlimited numbers and sorts of parameters, min/max the same, even arithmetic operators could be overloaded to work with complex numbers as well... :)
All function-types-problems and different-number-of-parameters-problems could be resolved.
ok, I admit: this is not ANSI C 99 - but C++ like...
it might get us 1 step closer to ACDC++
;)
examples: printf could work with unlimited numbers and sorts of parameters, min/max the same, even arithmetic operators could be overloaded to work with complex numbers as well... :)
Re: wishlist for NXC
Variable Arguments
By that, I mean that the arguments will be able to be passed as an array (as opposed to the traditional pointer).
Example:
In other words, we should be able to code our own
By that, I mean that the arguments will be able to be passed as an array (as opposed to the traditional pointer).
Example:
Code: Select all
long sum(long list, ...)
{
long out = 0;
for(unsigned long i = 0; i < ArrayLen(list); ++i)
out += list[i];
return(out);
}
NumOut(0, 0, sum(1, 2, 3, 4));
// Is equivalent to:
NumOut(0, 0, 1 + 2 + 3 + 4);
ArrayBuild()
.Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE
Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
Re: wishlist for NXC
that's not the issue of my wish.
My wish was about a general way to overload functions and operators with multiple counts and sorts of parameters which work possibly different depending on the special case.
Some extreme examples:
float foo(int i, float f) { return (i*f);}
float foo(int i, int j, float f) {return ((i+j)/f);}
int foo (int i, int j, int h) {return(i+j+h);}
void foo(float &f){f=sin(f);}
float f[2], g[2], h[2];
h=f *g; // * overloaded by complex multiplication: <=> h[0]=f[0]*g[0] - f[1]*g[1]; h[1]=f[0]*g[1] + f[1]*g[0];
My wish was about a general way to overload functions and operators with multiple counts and sorts of parameters which work possibly different depending on the special case.
Some extreme examples:
float foo(int i, float f) { return (i*f);}
float foo(int i, int j, float f) {return ((i+j)/f);}
int foo (int i, int j, int h) {return(i+j+h);}
void foo(float &f){f=sin(f);}
float f[2], g[2], h[2];
h=f *g; // * overloaded by complex multiplication: <=> h[0]=f[0]*g[0] - f[1]*g[1]; h[1]=f[0]*g[1] + f[1]*g[0];
Re: wishlist for NXC
Doc,
John has already expressed his intention to implement function overloads a while back. I bugged him about it incessantly at LEGO World last year so I can port my driver suite to NXC
- Xander
John has already expressed his intention to implement function overloads a while back. I bugged him about it incessantly at LEGO World last year so I can port my driver suite to NXC
- 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)
| 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)
Re: wishlist for NXC
really?
:P
when? (not when you bugged him but...)
;)
:P
when? (not when you bugged him but...)
;)
Re: wishlist for NXC
Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE
Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
Re: wishlist for NXC
muntoo,
it's a typo probably:
int pi=(int)3.14;
or:
for type conversion the new type is included in parenthesis, not the value ;)
but I wish to have that, too!
it's a typo probably:
int pi=(int)3.14;
or:
Code: Select all
float pi=3.1415;
int pii;
pii=(int)pi;
but I wish to have that, too!
Re: wishlist for NXC
Commit to LEGO Mindstorms Robotics Stack Exchange:
bit.ly/MindstormsSE
Commit to LEGO Stack Exchange: bit.ly/Area51LEGOcommit
Re: wishlist for NXC
correct, it's exactly as you said by yourself, function type cast is C++, not C
;)
;)
Re: wishlist for NXC
is there a chance to speed up the enh FW in relation to the std FW ?
Who is online
Users browsing this forum: No registered users and 0 guests