First, let me just put this:
C, C++, C#, Java, and whatever other language you want to list. They all have their places. No language is better than the other.
But you will run into problems if you the wrong tool for the job. In this case, C is the wrong tool for PC platforms, in most cases. Unless you need a reason to do so, such as the Linux kernel which is mostly C for compatibility and has an evil head that disregard anything that is C++.
My aim is not to say C++ is better than C. My aim is to make you understand that C is not the right tool for the PC platform! C++, C# and Java are all better alternatives, but not alternative is necessarily better than the other.
Yes, I can. Simple enough proof:
Originally Posted by smokeyangel
strcpy(buf, "Hello World");
strcat(buf, "! Bye World!");
Is this more complicated? Absolutely! Because you have the danger of a buffer overflow there.
s = "Hello World";
s += "! Bye World!";
Or how about your typical 2D array (dunno if I will get this right the first time):
int * p = malloc(50 * sizeof(int*));
for (int i = 0; i < 50; i++)
p[i] = malloc(50 * sizeof(int));
for (int i = 0; i < 50)
Which one is safer?
std::vector<std::vector<int>> v(50, std::vector<int>(50));
Though, this probably won't convince you, will it?
I beg to differ.
And yet safety critical systems, like in aeroplanes and cars do use C.
It is. I did not say it wasn't. It just goes to show we make mistakes. And with lots of code, we make many mistakes. And with many mistakes comes many bugs.
Of course, but that's true of any language, not just C.
I do not make stuff up, and that is not a contradiction.
I know. I pointed out to contradict your statement that C isn't right for modern systems.
The thing is, I'm not trying to engage in a C vs C++ debate. I don't think C++ is a bad language, or personally dislike it.
But you keep trying to say that C is an intrinsically bad language..... by making stuff up. "It's more complicated so it has more bugs" is clearly nonsense. You said that C is not able to deliver flexible, easy to read, bugfree and secure code on modern systems. The Linux kernel isn't bugfree or easy to read, but I wouldn't say it's a bad piece of engineering concocted by dangerous minds, would you?
You obviously dislike C, and there are valid reasons why C++ might be preferred in some situations, but you gain nothing by making random unsubstantiated statements of personal opinion dressed up as facts.
But that's probably pointless to argue.
Depends. If you are looking at speed, you may choose  (preferably when checking that it is bounds; but in time critical applications, there may not be time to do that, so you may just have to hope it runs right and does not crash and burn). If you want to write a safe program that should show an error for the user instead of crashing or behaving weird, you would probably choose the at function.
I didn't even know there was a std::array. I just looked it up -- handy. Although .... if you use overloaded [n] to access an out of bounds element, the behaviour is undefined? It only does bounds checking for at(n). I suppose for someone coming from C that's not so bad, as you always need to guarantee that the array access is in bounds in C, obviously. So use  when you've guaranteed it's within bounds, and at() when you think it is but can't guarantee it?
Depends on your point. I have no classes in C, or just some random bits and pieces.
Originally Posted by whiteflags
I have had one class on C++, and it sucked.
I have had one class in Java and I can't say it makes me like Java anymore.
I have had 0 classes in C#.
You bring the bull out by the horns. I don't know enough of this whole mess that is Metro or WinRT, so I am going to concede here.
On one hand, Metro is nothing like what you say it is. Wikipedia leads me to believe that it is a design language that makes programs look like windows phone apps. That certainly doesn't seem very relevant.
But further digging helped me find a slide from a build conference from over a year ago. C is on it:
Microsoft to developers: Metro is your future | ZDNet
It appears you mean the WinRT API.
Which is C++ with proprietary extentions:
Windows Runtime - Wikipedia, the free encyclopedia
So I will concede that you are at least factually correct. But if I may, do you have an intelligent answer to your own question? Why does WinRT exclude C? It would seem that C can use WinRT.
I am still trying to find a good source that explains the dangers of C.