Sandun, this is a good question so I thought to reply in publicwe use C++ for application programming , and C for operating system programming.Saman wrote:No Nandika. That will never happen. C++ is the oldest common programming language and still it is the mostly used and most popular language in the world.
If you take Operating Systems, almost all are developed using C++ including Windows 7, Ubuntu, Android, iOS, etc...
If you take firmware development, other than assembly, C++ is the mostly used programming language.
If you take compilers of other languages such as Java are written using C++.
So in simple terms, almost all are running on low level layers written using C++.
If there is no C++, that's the end of software world. That's guaranteed
but that doesn't mean we can't write OSes in C++ or C#.net or something else.
could you please correct that "C++" to "C" ?
This is a common misconception. When we refer C++, we refer the extended C language we used today. Not the coding style. C++ programs can be written in OOP style or sequential style. When we write OSs, it is true that most of the parts are written in sequential style but compiled using the same C++ compiler. there is nothing called C compiler today. Based on the extension (C or CPP), the same compiler distinguishes between them (such as special requirements for CPP such as large stack and heap for dynamic allocation).
If you want to see it, try cout in .C and printf on CPP and compile with your compiler. Both works without any hassle.
So in professional programming world, when we refer C we refer the legacy language we used decades ago with IDEs such as Turbo C. Not the sequential coding style we use today and compiled with the same latest compiler.
I think you now understand why I used C++.
Regarding OS writing with C. This is not correct. We made few tiny dedicated OSs for few ARM based embedded platforms and what we had used is C++ (OOP style) with C++ compiler that turn the code directly to target machine code. At the end of the day, you load machine code to the boot-strap and it has no understanding on whether it is written in C++ or any other high level language. Fundamentally, Kernel or nucleus of the OS is in the lower level and run in machine code. Whatever run on top of it can be anything else whether it is compiled or interpreted. So again it is a misunderstanding.
So in simple terms, C++ is referred to the C language extension we use today and C is referred to the legacy language that we no longer use. C style coding (sequential programming) or C++ style (OOP) programming is a choice made by the programmer.