Guru = C & Lame = C++
Hi
Thi may seem to be a silly question, but I am thinking about if since a while I have been wondering why all - most of - the programmes written on *nix are written in C not C++ Also linux gurus do not mension C++, Classes, new, delete etc. and insted use handlers (alternative to classes somehow) etc. So what is so special about C and not in C++ ?? |
I am in no means qualified to answer this question but perhaps it's because unix was originally written in c, and most programs don't *need* oo. ?
Just a guess :) edit: spelling |
Hmmm... What do you know about C, C++ or ObjC? Use the program lang YOU like!
And: There are many C++ apps for UNIX Environment (For example the KDE Project!) The most significant difference between both is the different programming-style... For newbes, both look like the same, but for pros each language contains it special abilities! Have Fun Martin |
You know why Linux kernel is written in C?
Because that time "Linus" was still a kid (20 something) and he didn't know how to program in C++ yet. |
heh i got blacklisted at college for pestering one of my instructors about how C and C++ had so much in common (loops, data, pre. proc., structs) .. he kept saying "but C++ has classes, its object oriented" well.. i think many CS students (especially at that school) can go a whole 4 years without being taught exactly what the point of object oriented programming is .. im sure I dont know ..
will someone please take a shot at explaining it to me .. ? |
I'm not sure this is right and it probably isn't, but the way I understand it OOP gives you away of modeling and structuring your code in a way that represents the real world problem you are trying to solve.
For example you may want to write a program which will be embedded into a kettle microchip. In C++ you may choose to have a kettle object. The kettle object will have a set of things it can do - like boil and stop boiling. It should also be able to communicate its state - e.g temperature of the water and whether or not its on or off. From your point of view what goes on inside the kettle is of no relevance to you. All you need to to is fill it with water and have the ability to turn it on to boil the water and also be able to see when the kettle has boiled. So the kettle is an object which encapsulates some code. The object has a user interface, such as a switch and the exact workings of the kettle are hidden in the casing and should never have to be changed. I hope I havn't completely confused you.:rolleyes: |
thats not confusing, except that it sounds so easy that i doubt my sanity ;)
|
That's the problem with OOP - it just confues the hell out of me. I understand the concepts but find it a lot easier to use the old fashioned modular approach.
|
if youv compiled a program that uses 'cin>>' and cout<< .. have you also compiled all the code required for 'cout<<setw(9)<<' ??
|
Quote:
C++ is good for large Applications - classes and namespaces are very usefull for object-based applications (like KDE or others) - The GTK-based programming can be very complicated, because you need the GObject-Model and other memory sharing/protection and so on... Have Fun! Martin |
Quote:
|
As I have stated before on C vs. C++ threads.... Back in 1991 the C++ support in GCC was pretty primative (compared to now anyway). That fact, and the fact that C was created specifically to build the UNIX operating system were probably the compeling reasons that Linux was built in C and not C++.
C++ certainly could be used for writing a complete OS kernel. But it certainly wasn't made for that (C++ was designed for higher level applications) and the choice of language has nothing to do with the design or stability of the software. I assure you C as a language is just as stable (and way more mature) then C++. |
Oh well, C and C++ share a very similar sintax but are completely different languages and refer to totally different programming models. There's no point on which is better. A lot of good applications are made in C, a lot of good applications are made in C++. A HUGE amount of bad applications are made in C and in C++ as well.
They are both powerful and quick. If you need low level programming maybe you will choose C, for high-level programming (say GUIs or modular systems) you will choose C++. I repeat, if you are a good programmer you will be able to take the best from both, and use the right language based on your needs. C vs C++ it's a silly problem... :) |
Quote:
But: Linux is a UNIX-Like operating system, using C++ coding it would require new abstracts with syscalls - they have to be exported in C-Style (not really a problem, but it would cause many-many incompatiblities since, if i'm not wrong, any existing POSIX-Like OS is coded in C or ObjC ... Even MSWin is, except of parts of the GDI, coded in C!) Symbian is not a UNIX-Like multi-purpose operating system, Symbian is an Embedded OS! It was designed to be coded in C++, it is structured for it and it is implemented in C++ (but as far as I know with many parts in C-Style code...)... You cann't compare Linux with Symbian, it's totally different. |
PSIplus:
the code only sucks as bad as teh coder can program. language realy doesnt matter. |
All times are GMT -5. The time now is 05:42 AM. |