This is a discussion on C or C++ within the General Discussions forums, part of the Community Boards category; Originally Posted by sean I think that makes it the perfect OS language. Using it for a user-friendly end-user app, ...
Of all the people I've met who would feel comfortable writing an OS/kernel in C, I can't say that any of them struck as being a good interface designer! The difference I see is that in one you're basically writing an interface to control the hardware, and any advantage counts, where as in the other you'll probably err on the side of faster development, and you're more likely to take a much more OO approach and use a language that lends itself to such a purpose. Additionally, I sometimes find that the libraries you use affect the "style" and feel of your code just as much as the language you choose.
Probably, but if you are talking about, eg, GUI libraries, etc., most of those are available for multiple languages. The "style" of the library is a constraint, but that is independent of the language. Of course, C is a little shy on libraries like this, but I think most of the major ones (gtk, SDL, etc) are there.Additionally, I sometimes find that the libraries you use affect the "style" and feel of your code just as much as the language you choose.
Recently I made an ncurses app for a site I work on, to make it easier for me and a few other people to accomplish certain routine tasks on the server. Ncurses is pretty much state-of-the-art when it comes to terminal apps -- the work is done via ssh login, so no GUI. But I didn't use the C library, I used Curses::UI for perl, which is a OO library. Totally, the factor there is development time. And the perl library contains things like ready-made widgets that are not part of the base C library. However, I believe there is a parallel Curses "user interface" lib for C.
I think I would have ended up with the same thing either way. Possibly, the C version might have been slightly better because I would have had to make a text editor widget myself, to my own specs. As is, the ready-made one is fine, but it is not EXACTLY what I would have done, if I had to do it myself.
Also worth note: virtually the entire GNU OS (aka linux) including the GUI front ends are in C (they also like python). Linux is I guess not traditionally known for user friendliness, but really there is nothing wrong with most of the individual apps...
Last edited by MK27; 11-12-2009 at 10:00 AM.
Yeah - I agree with that. You definitely can make an excellent interface in C, and I generally like the more linux-y interfaces - but that's because I choose functionality and keyboard usage over animations and effects any day. I'm just saying that if your primary purpose if making a nice interface to a typical program, C probably wouldn't be your first choice unless your were already intimately familiar with it - like most of the GNU folks, I'm sure!But I don't think using C will lead to an inferior interface, that is really up to you. An "OO approach" could just as easily lead to gimpy cookie-cutter style stuff.
C || C++?
I guess it really depends on how far you want to go with programming.
If you want to learn computer science, C is by far better choice. Mostly because it's so transparent, easy to translate to machine code in your head (some call it "portable assembly").
Also its strong relationship with Unix and Unix-like systems....all the code, manuals are written in C...so if you want to study OS....C is the way. Then there's just a large amount of code out there written in C..it's syntax is practically used as pseudo code in many books, tuts...
Also, it makes so much more sense to learn procedural programming before any higher level, OO language.
I started with C++, then realized that I don't understand what it does...sure I wrote some Hello World programs, but was not sure how it worked. Then bought KNR, moved on Unix platform and my knowledge began to grow rapidly.
C is the culture.
C++ and others are practical need to write less code faster. More acceptable for bigger applications, programs where efficiency is not that important, easier to understand and maintain....really great languages. And if you don't care about the "black box" and you just want to see the window floating on the desktop or you only care about solving practical problems...C is not the best choice.
There...I hope I made a choice a bit easier.
Mind you, C++ does not sacrifice efficiency. It is even more efficient than C at times. Otherwise you bring up good points.
For information on how to enable C++11 on your compiler, look here.