| Electronics > Beginners |
| what is the most relevant programming language for ee? |
| << < (12/21) > >> |
| brucehoult:
--- Quote from: HB9EVI on November 05, 2018, 08:12:45 am ---just to mention: even though the arduino language uses a c++ like syntax, it is in fact no c++, although it uses the gcc toolchain, there is no libstdc++ for the avr platform but only the avr-libc. --- End quote --- "Wiring" (the Arduino language) uses a common subset of C++ and Java and a custom library that has implementations in both. If you compile Wiring with C++ then a preprocessor adds a #include for the library, followed by forward declarations for all the top level functions in the source files (so that, like in Java, the user doesn't have to put them in any particular order). If you compile Wiring with Java then a preprocessor adds some imports and wraps all the user code in a class declaration. If you know that you'll never compile a given Wiring program with Java (as is the case with Arduino) then you can go crazy using almost the full range of C++ language features, but not the standard C++ library. |
| tggzzz:
--- Quote from: Karel on November 05, 2018, 07:23:01 am --- --- Quote from: Crazy_Pete on November 05, 2018, 05:06:46 am ---I would like to really underline that C is obsolete and if you have no experience in programming you should forget C (it will only teach you bad thoughts) and go right ahead to learning C++. --- End quote --- Now I understand your nickname. C is far from obsolete and is here to stay for a long time, whether you like it or not. And C++ is a terrible language... --- End quote --- :) "If C++ is the answer, you ought to reframe the question" |
| Crazy_Pete:
As i pointed out in a private message (and to the wrong person i think, i DO apologise!) Religion is also obsolete and here to stay whether we like it or not. C++ was designed as and functions as a drop in replacement for C. The arduino environment is C++ to a great extent. The compiler is the g++ compiler and the Arduino environment both includes and happily accepts code written in strict ANSI C++. Saying that Arduino uses a "Subset" of C++ is demonstrably false. The problem with learning C is that it like religion, it will train your mind towards obsolete thinking. If you are lucky enough not to be have been taught C, then forget C. Learning C++ will teach you everything you need to know about C and also give you the ability to use a higher level programming language. To say that there is no place for abstraction in hardware is a absurd. The arduino people used to say that until about 10 years when i showed them you could reduce program size by a few hundred bytes using C++ over C. I am sure that my efforts are a small part of a greater demonstration by many that convinced the Arduino people to make the Arduino environment C++. I hardly consider "It's here to stay whether you like it or not" as a positive endorsement. I can say the same thing about Herpes. (Which like religion, i am also immune to!) Of course C++ obsoletes C. I am not aware of ANYTHING you can do in C that you can't do in C++. If you choose for whatever reason not to use the OO features of C++, the increased type checking, overloading and namespaces found in C++ simply render ANSI obsolete as a matter of fact. (C++ when used as strictly a procedural language obsoletes C at the starting gate.) I knew this would turn into a typical religion versus science war, but to finish it off, exactly what can you do in C that you can't do in C++? Hilariously, the machines on which i learnt C++ are dwarfed by many of todays microcontrollers. I just purchased a half dozen ESP32 boards on the cheap from China! (Xi Xi China!!!!!) It is a 32 bit RISC machine with half a meg of STATIC RAM!!!! I can remember telling a fellow who was a certified Genius (you know they have a test for that, it is a called an IQ test.) "You know, i am really glad i learned C++, although i admit, having a machine with128K of DRAM sort of makes it cheating since that much RAM is a huge playground. I dream of one day having a computer running at 10MHz with half a meg of STATIC RAM! " He laughed and said "Not in our lifetimes." Now that unbelievable dream machine is an $8 USD dev board and people are saying "There is no room for abstraction on a platform like that". This is the ULTIMATE "HA! WHEN I WAS A BOY!" :-) Thanks to all. Peter |
| Sudo_apt-get_install_yum:
As many before me have said: C & C++ are the most used languages in embedded programming. Are they the best, probably. Here’s is why I think it’s so. C & C++ are one of the most used languages in the world and without a doubt the most used language in embedded programming so when the next person comes to update the product and has to redo the code they are going to have an easier time doing so since they most likely already know the language. If it was written in Python it most likely would be much harder to modify for someone on the outside since it’s a less common language in embedded programming. C & C++ are also universally used when it comes to µC’s so regardless of what company you go for or type of µC, your almost guaranteed to be able to program it using C/C++ But the most important thing in my opinion is how you program! An older product at work was created by an old colleague of mine. He was a C/C++ programming wiz but he was a wiz for high level software products. Like windows applications and such, these programs are designed to be "modular" so you can easily add/remove features. This is generally good because software is easily distributed and can be updated without much hassle, it is not the in the case of embedded design because much of the time you’ll never change the software on the product because most of the times it is linked to the hardware. Anyway the code was well written but not optimized for embedded use so it was really slow and didn’t perform as well as it could have. The µC in the product was a 32-bit ARM running at 32MHz and it was running horribly slow. This was later changed to an 8-bit Atmega running at 1MHz and it was kicking the ARM's ass by a long shot, both in performance and power consumption. The same guy who used the ARM also created a product using a 32-bit ARM running at 96MHz (Could be mistaken this was a while ago) and made a RTOS for it witch was WAY overkill for a product like that. It was never corrected because it would be to labor intensive but version 2 used a 16-bit micro at 8MHz, this kicked its ass as well! So the moral of the story is it’s not the language its how you use it! Or like some people say "It’s not the size that matters, its how you swing it!" |
| Crazy_Pete:
Sigh, Sorry for feeding the trolls. I did NOT check "save a copy" of sent messages in profile so i have no idea to whom i sent that private message about C and religion. Sorry about that if it was to the wrong person. I am also sorry for feeding the trolls. I wonder if we should start a new topic or area for Object Oriented Embedded Programming? Arguing with someone who says "X cannot be done" is a far less productive action than actually doing X and then showing the world how it is done. Thanks to all, Crazy Pete |
| Navigation |
| Message Index |
| Next page |
| Previous page |