Reply 80 of 132, by spiroyster
- Rank
- Oldbie
Yes agree with what others have said... there is no silver bullet language here... no language which gives the speed of a low level (ASM) with higher level syntax (C/C++). If there was, everybody would be using it.
If you know C, just expand on that, you won't regret it. C is basically the lowest (platform agnostic-ish) common denominator, even today. Most shared objects (.dll, .so) expose C interfaces, C allows inline assembly for extra ease (if you want to squeeze that extra bit out), pretty much every OS have C API's, and most libs that you will probably want to use have C API's (or if not there will probably be a equivalent lib with C API of what you want). This can't be said for many other languages tbh. If you used C, I doubt you would question learning other languages any time soon, If you didn't, I guarantee there will come the time when you will wish you knew C. 😉
When you write ASM, you are as close to metal as you are going to get so can program your intentions exactly as you need them. When you use a higher level language you are basically relegating your intentions to the language semantics and it's compiler or interpreter and are subsequently restricted by these metrics. Compilers can only guess at what your intentions are so can't always provide the most optimal code in all situations. Thats the trade off, and always has been. It could be argued that the performance of a language comes from the quality of its compilers... both C and C++ have very good ones!
Personally, ASM, I would stay away from in most/all cases, however since the platform is well defined in this case (DOS, x86). You would find this extremely beneficial and it will give you the best performance, but is obviously a completely different mind-set to higher level stuff.
Of course it all depends on what you want to do, if you just want to experiment with theory etc, an interpreted language (like BASIC) will probably be the fastest (and potentially easiest to learn) in terms of implementation and testing of algorithms.... but you would no doubt be rewriting in another language (C/ASM) if/when performance ever becomes an issue. tbh The more you practice with C, the less scary it would become, and some of the worries you mention would not even cross your mind. When I write something, while I do sometimes think, damn I got to write that scheduler or management logic... that’s half the fun of programming imo. That’s the creativity, conveyed in the architecture of how you design solution to the problem you are solving... all the nitty gritty details.
Also there is no excuse for not wanting to learn about memory!!! As been stated, memory management is not for your benefit, it's for the benefit of the stability of the rest of the system... relying on that is like saying you don't think it would be so bad to crash your car because you have air-bags 😵