|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
C or C++
which programming language is used in the robot for FIRST(FRC)... i see on the web site it says its C.... but my Team coach said it was C++?
some clarity would be helpful thanks |
|
#2
|
||||
|
||||
|
Re: C or C++
We use C with an IDE called MPLab by Microchip.
*edit* I wish we could use C++ though, then maybe we'd get some more programmers on our team. C tends to scare them off. (maybe that's MPLab's icky-sticky interface rather than the language itself )Last edited by thegathering : 13-11-2006 at 19:59. |
|
#3
|
|||
|
|||
|
Re: C or C++
Its C.
Quote:
|
|
#4
|
|||||
|
|||||
|
Re: C or C++
I don't think an FRC robot program is likely to benefit from object oriented programming in most cases. We're typically not dealing with a lot of objects that need to be created and destroyed that would benefit from a general class, mainly. There would be some benefit from the probable increase in code modularity and code reuse.
Mostly, however, I think objects inherently incur higher overhead costs than simple structures and procedure calls, what with instantiation and all sorts of things. So I don't think you could take advantage of the strengths of object oriented programming without making your code uselessly large. |
|
#5
|
||||
|
||||
|
Re: C or C++
Quote:
![]() |
|
#6
|
|||||
|
|||||
|
Re: C or C++
Quote:
|
|
#7
|
|||
|
|||
|
Re: C or C++
Quote:
|
|
#8
|
|||
|
|||
|
Re: C or C++
just be thankful you don't have to program it in assembly...
![]() C works terrific for a robots needs, when I'm trying to help the java peoples learn it, i tell them "object oriented programming with robots would be kinda useless. For example, what would be the point in Robot868 robot1 = new Robot868(void); robot1.drive(10.0); when you could write code that would simply be drive(10.0)? besides, the interface that Kevin supplies us with is alot more useful." Too bad its not so easy to describe #define, or any other preprocessors to them . |
|
#9
|
||||
|
||||
|
Re: C or C++
Quote:
|
|
#10
|
||||
|
||||
|
Re: C or C++
I think most of us would agree that we would rather have the flexibility and added features of C++, particularly object oriented-ness.
The problem with C++ is that along with its added features comes added bloat and inefficiency. Unless the architecture and processing power were SUBSTANTIALLY and unnecessarily upgraded, all of the people who keep complaining that C is primitive would be complaining that their code wouldn't run if we upgraded to C++. Memory allocation/deallocation is no small task, especially when handled in software. C++ is good for PCs where functionality is a greater priority over efficiency and there is an abundance of computational power, but not so great for our application. In industry, C is not considered outdated, it is the standard in the world of embedded programming and for good reason. C is sleek and slim. Heated seats, radios and air conditioning are good to have but race cars don't have them and do just fine without them. Our robots, like race cars are designed minimalistically. There is nothing on a FIRST robot that is not absolutely necessary and that goes for code too. Any problem that can be solved in C++ can be solved in C. The solution may not be as coder friendly, but chances are it will be smaller and take fewer processor cycles to execute. Last edited by Rickertsen2 : 14-11-2006 at 21:02. |
|
#11
|
|||||
|
|||||
|
Re: C or C++
Quote:
Quote:
![]() |
|
#12
|
|||||
|
|||||
|
Re: C or C++
Quote:
|
|
#13
|
|||||
|
|||||
|
Re: C or C++
Quote:
Modular programming is obviously a good thing, but I don't really see a good use for classes and inheritance and polymorphism and such. |
|
#14
|
|||
|
|||
|
Re: C or C++
It's amazing the misconceptions that have been posted here about the differences between C and C++. C++ code doesn't have to be bloated compared to equivalent C code. When using the advanced features you do have to know what you're doing if you don't want to pay a size or performance penalty.
I used C for years and then moved to C++. Moving back to C was an extreme shock. Having to jump through hoops to do reasonable encapsulation and using funky naming conventions to keep the code organized and readable is a roaring pain. The lack of proper const types is inhibiting. Some here seem to think that using C++ entails a lot of new and free calls to create and destroy objects. If your C code isn't using a lot of malloc and free calls, there will be no difference. And for a FIRST robot you really don't need any dynamic memory allocation. C++ is a much better language and with proper use can even produce smaller, faster code than C. Not to mention if the code is properly written, it's easier to understand, maintain, and more robust. |
|
#15
|
|||
|
|||
|
Re: C or C++
I always thought the problem with object oriented languages and microcontrolers was the async nature of OO. In other words OO is terrible for RTOS's.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|