Why don't some languages allow declaration of pointers?

前端 未结 7 1637
半阙折子戏
半阙折子戏 2020-12-31 05:41

I\'m programming in C++ right now, and I love using pointers. But it seems that other, newer languages like Java, C#, and Python don\'t allow you to explicitly declare point

7条回答
  •  被撕碎了的回忆
    2020-12-31 06:29

    As someone already mentioned, pointers can, and actually, will go wrong if you have a massive application. This is one of the reasons we sometimes see Windows having problems due to NULL pointers created! I personally don't like pointers because it causes terrible memory leak and no matter how good you manage your memory, it will eventually hunt you down in some ways. I experienced this a lot with OpenCV when working around image processing applications. Having lots of pointers floating around, putting them in a list and then retrieving them later caused problems for me. But again, there are good sides of using pointers and it is often a good way to tune up your code. It all depends on what you are doing, what specs you have to meet, etc.

提交回复
热议问题