C or C++ or C#

Started by
46 comments, last by Sneftel 16 years, 7 months ago
I'm not nearly a wiz with the technical side of the machine as others might be so I can't really say but I can say this. I learned VB6 first as the first real language that I programmed in and I never quite felt confident as a programmer, I felt that too much was hidden from me. But when I learned C++ I felt like I had a better concept of how things worked. A light went off when I learned that a string was characters in an array. a light went off when I learned about pointers. A light went off when I learned about the stack and the heap. (which was explained in every tutorial I've read about C++ but not once on a tutorial I have read on Java or C#, could be coincidence) Now, maybe C#, Java, VB, etc can teach all of that too but it's not intuitive like C++. And maybe how they treat all these features are completely different then C++ but, what I can say is that I feel a lot more confident after learning C++.

If I can make a poor analogy, it's like baking a cake. With VB and I'd argue C# and java are the same, I felt like I was grabbing a cake mix adding water and making cake. It was fast, it was good and it worked but I wouldn't get the same feeling of understanding a cake until I mixed the floor, chocolate, etc by hand. One could say that truly, the cake is in the chemical compound. And neither one will teach me this but having to do everything by hand made me feel like I understand it all better.

I don't know if any of that makes sense but I definately see a good value behind learning C++, maybe not right away but soon after. And of course assembly.

There's all this debate about if it teaches logic, the machine, or virtual machine and what not. Place whatever I said where ever you want it. I'm just saying C++ helped a lot, I feel the natural structure of the language made me look a little bit deeper.
Advertisement
I think you've missed the point entirely.

You're claiming C++'s "natural structure" made you "look deeper," and that you suddently felt you like a better concept of how things worked after you switched to C++. This is wrong. You may have a better understanding of the concepts in C++, but that doesn't scale to the general case; that doesn't scale to the level of being remotely connected to the actual metal running the actual software... But this is what the majority of mis-information about C and C++ leads one to believe, that in learning C++ they learn what's going on. The whole point of the recent discussion here has been to illustrate how, while the models chosen by C or C++ to represent some things (strings, pointers) might have a lower-level nature than what you may have experienced before, they're not the be-all-end-all of how the machine works. A string is not neccessarily characters in a null-delimited array, pointers are not neccessarily numbers, the stack and the heap are not universal concepts and they are not even neccessarily the same thing across programming languages.

This isn't to say that C++ isn't worth learning, this isn't to say that the C++ model for the aforemention things is wrong. What is wrong is to assume that the C++ model for those things is universal. Like strings, "pointers" or references, the stack and the heap in just about every other language and platform, all of those things are abstractions.
I think C can be useful to understand how some features of other high level language works because that features are implemented in C. But asm is the only language that can teach something about the inner working of the system (even if also the assembly language is an abstraction).
Both aren’t the best suited languages for beginners. They can be useful, but at the beginning you should learn the higher level stuffs. You should learn how to arrive to a solution. The other things are secondary. And in C is harder to learn that things than in other languages like C#.
As a fan of C, I'm a little agitated by the number of insults flying around against the language, but I'm also a little surprised that people are trying to defend C as being better for learning about how your computer works on the inside. While I can certainly see some limited examples of that being true (most of which have already come up), that's really not what you should be learning the language for.

In my eyes, none of the 3 languages really has a whole terrible lot over the rest. Anything you can do in C you can do in C++ and C# (with the exception of some of the picky cases you probably ought not be messing with anyways). The decision of which to learn comes down to which one you find easiest to work in. I use C because I'm not a real big fan of OOP. Just a personal preference. I haven't worked with C# yet (actually installing VC# right now), but I think I would probably recommend it over C++. C++ is the weakest of the 3 languages, imo. It's just plain uglier than C or C#, in my experience with it. But again, I can't stress enough that it's almost entirely your personal preference. Whatever language enables you to solve your problems fastest is the language you should use.

Toward that end, I recommend you at least dabble in all 3, then decide which one you like best.
Quote:Original post by Promit
I just want to point out that null terminated strings are a C concept. They have nothing to do with the low level workings, or inner workings, or any of that bullshit. Most languages don't even use null terminated strings; C++, Java, C#, and Pascal/Delphi all store explicit lengths.

Ok, but no-one said null terminated strings weren't just a C concept.
(I did say that null termination is a LL concept that C will expose you to)
You don't seem to have any comprehension of the difference between C concepts and "low level" concepts.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Ok, seeing that I can't comprehend this, can you at least explain why the general concept of null-termination is specific to the C language (instead of just insulting me)? [edit]It is funny tho, that you're insulting my comprehension just after launching a rebuttal to an argument that wasn't actually made[/edit]

The way I see it: Null termination is a general low-level computer concept (albeit not a very useful one) that transcends use by a single language. I was taught about null termination (or 9999-termination, etc...) back in school in a module about general computing algorithms, before I had even learned C yet.
I'm angry about programming languages!

This topic is closed to new replies.

Advertisement