Page 2 of 2

Re: LEGO mindstorms NXT power programming: robotics in C

Posted: 09 Jan 2011, 04:33
by m-goldberg
mattallen37 wrote:I think sub is basically identical in function to void, but it is not as efficient, IIRC.
'sub' is an exact synonym of 'void' IIRC. 'sub' is simply an inheritance from NQC, which did not have 'void'.

Re: LEGO mindstorms NXT power programming: robotics in C

Posted: 09 Jan 2011, 05:01
by muntoo
m-goldberg wrote:
mattallen37 wrote:I think sub is basically identical in function to void, but it is not as efficient, IIRC.
'sub' is an exact synonym of 'void' IIRC. 'sub' is simply an inheritance from NQC, which did not have 'void'.
Everyone uses "void", because that's what C/C++ have.
No one uses "sub" which used to be part of NQC, and is "deprecated".

Re: LEGO mindstorms NXT power programming: robotics in C

Posted: 09 Jan 2011, 06:54
by borntoown
Thanks again;
mattallen37 wrote: Well, then please explain what you mean by "files". do you mean the general concept of files on a computer? If you are referring to the file system on the NXT (reading and writing files with an NXC program), then I don't think you are ready to try to understand how to do it.
Yes, I meant the file system on the NXT. You can explain it, and I'll see (Because as I said, I don't make a program without it).

Thanks,
B2O.

Re: LEGO mindstorms NXT power programming: robotics in C

Posted: 09 Jan 2011, 07:19
by mattallen37
As far as the whole thing with sub vs. void, I am sure there was SOME reason that void is the better one (not just because of being "standard").

In regard to the file system, I don't know a whole lot (I have only used it in maybe 10 or so simple cases). To post any example, I'll have to wait until I am using the computer that I program on.

Re: LEGO mindstorms NXT power programming: robotics in C

Posted: 10 Jan 2011, 04:49
by muntoo
mattallen37 wrote:As far as the whole thing with sub vs. void, I am sure there was SOME reason that void is the better one (not just because of being "standard").
We can argue about it all day, but I know John once said:
John Hansen when he was apprenticed to Yoda wrote:Void is emptiness. The alias of void is sub. Nothing more, but the remnants of NQC.
sub exists as backward compatibility with NQC. It's probably defined like this:

Code: Select all

#define sub void
OR this:

Code: Select all

typedef void sub

Re: LEGO mindstorms NXT power programming: robotics in C

Posted: 16 Jan 2011, 17:24
by afanofosc
sub == void. Simply in NXC for the sake of NQC familiarity/compatibility.

If you want to write code that is as like C as NXC can be then you should not use sub.

John Hansen

Re: LEGO mindstorms NXT power programming: robotics in C

Posted: 16 Jan 2011, 18:32
by mattallen37
Okay, thanks for clarifying.