Electronics > Beginners
what is the most relevant programming language for ee?
bd139:
This isn't a religious war for ref.
Just a point, I've been writing C++ for about 20 years and C for about 25. On Windows, Unix and embedded systems.
You are completely wrong. C++ is a different language. It's not a drop in replacement. Even Stroustrop said that.
C++ has a hell of a lot more foot guns which really do bugger you pretty hard:
1. Very unstable ABI
2. RTTI
3. Exceptions (non explicit control flow)
4. Little control of stack
5. Poor allocation control (try writing a C++ program that doesn't allocate)
6. Name manging from templates
7. Buggy as fuck compilers
8. autos.
9. No one who likes C++ has had to debug something someone has used more than 2 STL templates in.
10. Toolchain instability
You can spot the problems when you look at the coding guidelines every organisation has. Everything is "don't use features X, Y, Z".
It's not what can you do in C, it's what can't you do in C and how you are forced to think. And that is in terms of tangible memory, abstractions and algorithms. Every foot is carefully placed. Never do you step in shit.
So you can get a 32-bit machine with a meg of RAM for $8 but you can get an 8-bit machine with 4k of RAM for $0.50 and solve the same problem.
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 ---
to which the response was...
--- Quote from: Crazy_Pete on November 05, 2018, 12:03:31 pm ---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!" :-)
--- End quote ---
QED, I believe.
tggzzz:
--- Quote from: bd139 on November 05, 2018, 12:58:52 pm ---6. Name manging from templates
7. Buggy as fuck compilers
10. Toolchain instability
You can spot the problems when you look at the coding guidelines every organisation has. Everything is "don't use features X, Y, Z".
--- End quote ---
While I agree with your other points, those points are the real killers - especially the last.
Subsetting a language is an orange flag, especially when every organisation chooses a different subset.
And never forget the https://en.wikibooks.org/wiki/C%2B%2B_Programming/Templates/Template_Meta-Programming#History_of_TMP
where the key, horrifying, accurate word is "discovered". Here's a first-hand account of what happened and Soustroup's reaction:
https://translate.google.com/translate?sl=de&tl=en&u=http%3A%2F%2Fwww.erwin-unruh.de%2Fmeta.htm
Wimberleytech:
--- Quote from: kripton2035 on November 04, 2018, 05:05:13 pm ---as a programming language, I learned Basic during my EE degree, 30 years ago ...
well I did not learn it because I knew it before, but that's all we were teached at that time.
--- End quote ---
My first programming language was FORTRAN (more than 30 years ago!!). However, when I need to solve a problem today (not write an app to sell or give away), I use BASIC. Why?? Because LibertyBasic offers a great Windows interface that is quick and easy, it is my go to (not goto) to get an answer. Just the other day, I wrote a BASIC program that fixes the damn QFX data format that Wells Fargo has found a way to screw up!!
When writing embedded stuff, I use C (for the arduino or a SiLabs micro)...because that is what Arduino and Keil provide.
...and...of course...Excel
kripton2035:
I use Xojo basic simply because it works on mac,win,linux,raspberry quite with the same source code
and on iOS with some resource, and soon android.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version