Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is C/C++ one language or two languages?

Tags:

c++

c

c++-faq

Is C/C++ one language or two languages? I heard C++ was just C with classes. Is that right?

like image 733
Scott O'Donnell Avatar asked Jan 15 '13 02:01

Scott O'Donnell


2 Answers

C++ diverged from C in 1982-1983, and that's a long time in computer years. But, there are many C libraries with C++ compatibility, including the C standard library itself, and a steady stream of programs are ported across from C to C++. Many C programmers only know or use the features that are compatible with C++.

They are defined by different ISO standards from separate committees. Even when they define compatible features, it is often defined in different terms.

Referring to C/C++ is about as valid as referring to Italian/Spanish. You should be careful to whom and when you use such a term. But it's true that there is diffusion of ideas in both directions, and the similarities are more than coincidence.

like image 123
Potatoswatter Avatar answered Sep 18 '22 19:09

Potatoswatter


"C/C++" is precisely zero languages. It does not exist.

On the other hand, C is a language.

C++ is another language, which is kind of like C but also has classes and lots of other differences.


To be clear, @Zoidberg was spot on:

C and C++ are two completely different languages. C with Classes was the predecessor of C++, but the term is still often used for non-modern C++ (e.g. that uses raw pointers all over the place).

like image 21
Lightness Races in Orbit Avatar answered Sep 17 '22 19:09

Lightness Races in Orbit