View unanswered posts | View active topics It is currently Thu May 23, 2013 7:42 am






Reply to topic  [ 6 posts ] 
Just Curious... 
Author Message
Rookie

Joined: Fri May 20, 2011 6:01 pm
Posts: 20
Post Just Curious...
I have been working with robotc for a few weeks now and am very curious about what the major differences are between RobotC and C/C++. has anybody worked with both languages before? and if so, what reference sites would you recommend for someone transitioning from robotC to C? Thanks in advance.


Wed May 25, 2011 3:21 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 2864
Location: Rotterdam, The Netherlands
Post Re: Just Curious...
The biggest difference is lack of pointers :) To transition from ROBOTC to regular C (or C++) there aren't really any guides. You'll need to be prepare yourself for a pretty steep learning curve, though. Embedded C/C++ programming is a lot more challenging than ROBOTC.

Is there a specific reason you are looking to move away from ROBOTC? Perhaps C/C++ is not the answer to your problems, there is also a great Java implementation for the NXT.

- Xander

_________________
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)

| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Thu May 26, 2011 1:05 am
Profile WWW
Rookie

Joined: Fri May 20, 2011 6:01 pm
Posts: 20
Post Re: Just Curious...
i was not planning to stop using robotc, i just wanted to get involved in computer programming. Thank you for the reply


Mon Aug 08, 2011 2:40 pm
Profile
Rookie

Joined: Wed Mar 31, 2010 4:43 pm
Posts: 12
Post Re: Just Curious...
mightor wrote:
The biggest difference is lack of pointers

How so? The pointers are broken, yes, but you can pass a variable by reference, so isn't that pointers, kinda?

RobotC also doesn't allow multiple assignment operators in a single statement, which other languages allow (I think):
Code:
motor[motorLeft] = motor[motorRight] = 50; // Fails silently

_________________
FTC #248: Fatal Error, programmer, Drive team
FRC #3142: Aperture, Lead Designer, Lead Programmer, and Lead Builder.
ZR #89: TBD, programmer.
And I help three FLL teams.


Mon Sep 12, 2011 8:22 pm
Profile
Moderator
Moderator
User avatar

Joined: Wed Mar 05, 2008 8:14 am
Posts: 2864
Location: Rotterdam, The Netherlands
Post Re: Just Curious...
They're not broken, they just haven't been implemented. No breaking what's not there :)

As for using the multiple assignment statements, I tend not to use those because it doesn't make my code any more readable and it's not more efficient.

- Xander

_________________
| Some people, when confronted with a problem, think, "I know, I'll use threads,"
| and then two they hav erpoblesms. (@nedbat)

| My Blog: I'd Rather Be Building Robots
| ROBOTC 3rd Party Driver Suite: [Project Page]


Tue Sep 13, 2011 1:18 am
Profile WWW
Guru
User avatar

Joined: Sun Nov 15, 2009 5:46 am
Posts: 1023
Post Re: Just Curious...
Skinkworks wrote:
but you can pass a variable by reference, so isn't that pointers, kinda?

Pass by reference is nowhere as useful as full pointer support. For example, you can store pointers in a structure but you can't store "references" in a structure. Without pointers, it is extremely difficult to implement object oriented programming. I tried doing it without pointers but the code is a mess. For example, to represent multiple instances of an object, I had to create a global array of structures. Instead of passing the pointer of an object around, I had to pass the array index around as the "object handle". All the functions that take "object handles" must have access to the global structure arrays. What a mess! In addition, full pointer support will also help in implementing cooperative multi-tasking where I need to do event-driven callbacks. This requires function pointers. Without it, I had to hard code callback function names in the task manager. Again, it is a mess!


Tue Sep 13, 2011 2:09 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 7 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.