View unanswered posts | View active topics It is currently Fri Aug 01, 2014 1:44 am






Reply to topic  [ 9 posts ] 
NewB Questions 
Author Message
Rookie

Joined: Fri Oct 25, 2013 11:34 am
Posts: 8
Post NewB Questions
I am helping my son transition to RobotC from NXTG - I have over 30 years experience with C and a couple of questions came up with our first attempts. Thanks in advance if this info is already answered but we searched and did not find it.

1) Why are none of the RobotC interfaces for display in the function library reference in the left window? There seems to be a lot that the autocomplete understands but is not included in the left window as elements you can drag and drop on a program.

2) Many things in RobotC seem different than other C environments I have used. For example the routine "exit()" does not exist which is the standard way for a C program to end. Also I noticed that variables are not by default initialized to zero - I know this is a bad assumption but for example "int i;" does not cause "i" to have value zero - this is common in most C runtime environments. Is there a paper or anything that describes the differences between RobotC and C?

Thanks in advance for the great product!


Fri Oct 25, 2013 11:51 am
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: NewB Questions
TheKog wrote:
I am helping my son transition to RobotC from NXTG - I have over 30 years experience with C and a couple of questions came up with our first attempts. Thanks in advance if this info is already answered but we searched and did not find it.

1) Why are none of the RobotC interfaces for display in the function library reference in the left window? There seems to be a lot that the autocomplete understands but is not included in the left window as elements you can drag and drop on a program.

2) Many things in RobotC seem different than other C environments I have used. For example the routine "exit()" does not exist which is the standard way for a C program to end. Also I noticed that variables are not by default initialized to zero - I know this is a bad assumption but for example "int i;" does not cause "i" to have value zero - this is common in most C runtime environments. Is there a paper or anything that describes the differences between RobotC and C?

Thanks in advance for the great product!

I don't understand your question 1. Are you asking why the "function library" pane on the left does not contain some of the functions that might be suggested to you through tool tips while you type? If so, as far as I know, the documentation is sometimes not catching up with the changes in RobotC. For me, I would consult with the code. There is a file called RobotCIntrinsics.c in the folder "C:\Program Files (x86)\Robomatter Inc\ROBOTC Development Environment\Includes". This file contains all the intrinsic functions supported by RobotC. Since this is code, it must be up-to-date with respect to the RobotC versions you have.
There are several aspects for your question 2. First, RobotC is not standard ANSI C. For example, although it supports pointers since 3.x, it still doesn't support function pointers. Also, RobotC support some C++ features such as function overloading, parameter initialization etc, however, it doesn't support class. In other words, it is not an Object-Oriented-Programming language.
Regarding your question on variable initialization, it depends on what kind of variable you are talking about? Even for other compilers such as Microsoft Visual C/C++, only global variables are zero initialized because they are created at compile time in the data segment. For local variables in the functions, they are stack variables that got dynamically created when the function is called. These variables are not usually initialized (even in Visual C/C++).
Regarding your question on the function exit(), there is no "built-in" functions in the C/C++ language spec. So in general, the compiler does not really know about functions such as exit() or even printf(). Functions are provided by the "run-time library". And yes, there is a "Standard ANSI C runtime library" that people are used to and love but for C/C++ languages specifically designed for a certain platform and environment (such as in embedded environment or robotics), there is no obligation to support the whole ANSI C runtime library. Many platforms prefer to support some but not all of the standard C runtime library functions. Like I said, check out the RobotCIntrinsic.c file and you will see all the functions supported by it.
Hope that answers all your questions.


Fri Oct 25, 2013 3:25 pm
Profile
Rookie

Joined: Fri Oct 25, 2013 11:34 am
Posts: 8
Post Re: NewB Questions
Thanks for the fast answers - everything you are saying makes great sense and I appreciate it.

I guess the question I have left is about the function library pane - I am saying I do not see MANY functions that are in the function library anywhere in the pane - for example the display functions. This is the latest install - one would think all the functions in the library would be available there.

While I have no problem using all the diverse resources to find what I need it is not very helpful to one with less experience (like my son).

So my question is WHERE ARE THE DISPLAY FUNCTIONS in the function library pane? Are they there? If not, why? LOL Thanks again


Fri Oct 25, 2013 10:28 pm
Profile
Professor
User avatar

Joined: Sat May 18, 2013 1:24 pm
Posts: 272
Location: Olympia, WA
Post Re: NewB Questions
They're on my install of RobotC 3.62.


Attachments:
Function Library - Display.png
Function Library - Display.png [ 48.75 KiB | Viewed 1705 times ]

_________________
FTC Team 6424, the 'Oly Cow - Chief programmer.
FRC Team 4450, Olympia Robotics Federation (ORF).

and also quadrotors. Quadrotors!
Sat Oct 26, 2013 12:22 am
Profile
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1347
Post Re: NewB Questions
TheKog wrote:
I guess the question I have left is about the function library pane - I am saying I do not see MANY functions that are in the function library anywhere in the pane - for example the display functions. This is the latest install - one would think all the functions in the library would be available there.
...
So my question is WHERE ARE THE DISPLAY FUNCTIONS in the function library pane? Are they there? If not, why? LOL Thanks again

What display functions are you looking for? Are you thinking about using them for debugging? If so, you have several options, one is to use the LCD display. The nxtDisplay* functions shown by Ernest's screen capture are there for that purpose. There are also the writeDebugStream* functions (under the debug category) that transmits the output back to your laptop and display them on the debug stream dialog. The down side of that is the limited bandwidth when your communication link is Bluetooth (i.e. if you try to print a lot of stuff inside your tight robot loop, you may overwhelm the link).


Attachments:
debugstream.JPG
debugstream.JPG [ 22.38 KiB | Viewed 1704 times ]
Sat Oct 26, 2013 12:50 am
Profile
Rookie

Joined: Fri Oct 25, 2013 11:34 am
Posts: 8
Post Re: NewB Questions
I just dont understand = on both mine and my son's systems this image is all we have in the function library window - yours above has so much more! What are we missing, lol?


Attachments:
menu.jpg
menu.jpg [ 57.86 KiB | Viewed 1529 times ]
Sat Oct 26, 2013 6:59 pm
Profile
Rookie

Joined: Fri Oct 25, 2013 11:34 am
Posts: 8
Post Re: NewB Questions
OMG never mind it was the basic menu level vs advanced and super user. Thanks again guys. This is his first excursion into the world of C oriented languages beyond NXTG and I have to show him they way ;)


Sat Oct 26, 2013 7:01 pm
Profile
Professor
User avatar

Joined: Sat May 18, 2013 1:24 pm
Posts: 272
Location: Olympia, WA
Post Re: NewB Questions
Nice catch! I just noticed that yesterday. Glad you figured it out. :)

_________________
FTC Team 6424, the 'Oly Cow - Chief programmer.
FRC Team 4450, Olympia Robotics Federation (ORF).

and also quadrotors. Quadrotors!


Sat Oct 26, 2013 9:05 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 3165
Location: Rotterdam, The Netherlands
Post Re: NewB Questions
There's a secret Jedi level, but it can only be enabled using mind control.

= Xander

_________________
| Professional Conduit of Reasonableness
| (Title bestowed upon on the 8th day of November, 2013)
| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Mon Oct 28, 2013 2:06 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 9 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.