+ 3
Pointers in C, C++, and C#: Essential for Performance or Productivity Blockers?
Pointers are fundamental in C and C++ for memory control and performance optimization, but many developers argue that they hinder productivity, especially in large and complex projects. With the advent of C#, which chose to limit pointer usage and prioritize memory safety, a new debate has emerged: to what extent are pointers indispensable for efficient development? Does the absence of pointers in C# boost productivity by reducing complexity and errors, or is it a significant sacrifice in terms of performance? In which cases are pointers truly essential, and where can they become a productivity blocker?
7 Antworten
+ 5
This forum is for people to get help with their coding homework. You seem to be doing some type of survey asking many questions like this. That's not really what this forum is for.
If you are doing some training here and one of the coding challenges is giving you trouble, that is what this discussion forum is for.
+ 3
Sorry if I misunderstood. But I study several programming languages simultaneously. I study Python, C, Lua, C++ and C#. So I notice certain subtleties in some situations involving them. Like the issue of pointers that I mentioned, for example. I believe that the forum is also for debating and clarifying doubts. I like to learn from others, because a different point of view opens our minds to other possibilities. This makes our coding thinking flow better.
+ 2
If by productivity you mean deliver a working code as fast as possible, then a higher level approach like that of C# is indeed the right choice.
You wouldn't choose C or C++ for situations where you have to revise and update your codes frequently.
Pointers are used if you are trying to optimize performance. The goal is not to write code as fast as possible but to make your existing code run as fast as possible. This is a different goal.
You wouln't use C# to write drivers and real time applications.
Your question is trying to mash two different scenario and come up with a generalized conclusion, which is not useful at all.
Which is better, a spoon or a shovel? A spoon is bad at digging dirt, but a shovel can't fit in your mouth. You can view C and C++ as spoon and C# as shovel.
+ 2
"Which is better, a spoon or a shovel? A spoon is bad at digging dirt, but a shovel can't fit in your mouth. You can view C and C++ as spoon and C# as shovel." (Bob_Li)
Thank you very much. I found a good analogy. It made me understand the situation well. I ask questions like this to become a better programmer. You helped me in just one answer to understand concepts of 3 programming languages. Thanks again.
+ 1
It looks more like you are posting your CS homework questions here. That's not allowed.
0
I have heard this bs you posted 386 times. Memory safety, productivity etc does not depends on the language alone.
It also turns out that since c++17, it's rare to have memory issues caused by pointers.
0
Maybe you are talking about practical and simplicity consideration in accessing or modify data using pointer. Yes, especially related to dynamic memory allocation which has high level of usage. You just need to point out to the memory location which is occupied by certain variable. Dynamic memory allocation itself limited by the amount of memiry space owned by your device.