(aside from the speed increase if you were to optimize c/c++ code and the closed source options with c/c++)
I am trying to figure out what you can do in c++ that you cannot do in for example Python. I've googled a bit to find a lot of people say bit shifting, but you can shift bits in python as well?
1 2 3 4 5 6 7 8 9 10
metulburr@Ubuntu:~$ python3
Python 3.2.3 (default, Oct 19 2012, 20:13:42)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license"for more information.
>>> int('01110001', 2)
113
>>> chr(int('01110001', 2))
'q'
>>> chr(int('01110001', 2) << 1)
'รข'
and i also have come across where some say that c/c++ is being used because everything is already written in it, and would cost more to port a million lines of code over to (lets say python) and have one programmer maintain it, than to just leave it and have 10 programmers maintain it. And not to mention the profit-loss of the time it takes to port it,, and obviously, the actual time to port it.
I was really looking to grab a code snippet of something in c/c++ that makes it shine, and say "try to do this is python".
C++ is used when speed is highest priority (advanced 3D engines, mathematical evaluations, etc.).
what would you define as advanced 3d engines?
The part i dont understand is python's 3d is sufficient isn't it? How advanced do you mean? http://www.vrplumber.com/py3d.py
Are you referring to like the latest cutting edge graphics in gaming?
I am probably having trouble understanding the concept as i used 2d and see others writing python 3d games. In which some tweaking in python can get it up and running with no issues. Not top end games with crazy latest graphics. But decent working 3d games. I dont know i am having trouble wrapping my head around the complexity and length it takes to write code in c/c++.
Python is better where speed and memory is not the most important thing but code re-usability and readability.
isn't this like 90% of the time? Some of the operations are so tedious.
I dont know maybe i'll just stick with python until speed becomes an issue. It's not like i will ever participate in the latest graphical game.
It is like that. That's why interpreted languages like python, ruby or perl became so popular.
Still i find c and c++ more used in industrial market or specialized application where speed is most important (adobe photoshop, windows, trace32, etc.).
If i were to create some utility program i would stick to python, but if i were to create some simulator or technical design editor i would definitely do it in c/c++.
ok thanks, i have another question regarding speed. As time goes on, we get more and more RAM, faster CPU's, etc. If a program ran at a inadequate speed with python before, with a new pc, wouldnt it in theory run faster (maybe inadequate maybe not)? I mean just a few years ago we were using single core, maybe 2 cores at X speed with like 2 GB RAM, now-a-days we have like 20 GB RAM, 8-16 cores running at even faster speeds. I would assume the speed issue line would become fuzzy?
This situation is occurring right now, which can be observed by huge amount of high level languages being developed.
See this:
compiled c++ program - os - h/w
python bytecode - virtual machine or interpreter - os - h/w
os - operating system, h/w - hardware
Better h/w, faster virtual machine or interpreter is.
In case of desktop application, lets say - music player, human wouldn't feel any difference between python and c++ program, even if some is slower than other by few microseconds.