What makes C++ so good?


Answer by Harsh Kothari:

1: Stronger Type Checking – the use of classes, inheritance & automatic type conversions mostly eliminates the need for the abominable void* of C.

2: Type safe linkage – you can’t accidentally call a routine from another
module with the wrong type and/or number of arguments – even if your header files get out of date.

3: A complex data type is provided. It includes all the standard arithmetic operations, implemented as operators, not function calls.

4: User-defined operators and function overloading are supported. When you design a data type you can specify which operators & functions are provided.

5: You can use class libraries to provide robust new data types which can be made exceptionally easy to use.

For example, the Rogue Wave ‘math.h++’ class library implements general multi-dimensional arrays which can be manipulated with high-level operations
and an intuitive syntax:

DComplexArray a(10,10); // Construct a 10×10 complex array
cin >> a; // read it in from standard input
DComplexArray b = inverse(a); // Calculate the inverse
cout << b; // write out the inverse
cout << variance(b.diagonal()); // write out the variance of the diagonal
elements of b

6: You can define automatic type conversions to convert between data types.
For example, the Rogue Wave library provides a conversion from a double array
to a complex array.

DoubleVec a(10, 0.0, 1.0); // Construct a double vector in initialised to
{0,1,2,3,4…
DComplexVec z = a; // Construct a complex vector initialised to
{(0,0),(1,0),(2,0),…
cout << a; // write them out
cout << z;
cout << cos(z)*exp(DComplex(0,1)*a);

7: Provides inline functions which combine the efficiency of using macros
with the safety of using functions – simply prepend the word ‘inline’ in
front of the function – if the compiler can inline it, it will.

inline Double
SumOfPositiveElements
(const DoubleVec&amp; v)
{
Double theSum = 0;
for (int i = 0; i < v.length(); i++) {
if (v[i] > 0) {
theSum += v[i];
}
}
return theSum;
}

8: C++ Compiles most ANSI C code directly and can call compiled C code
directly, so you don’t even have to learn anything new at all!

9: You don’t have to put all of your declarations at the top of each block
in C++.
This means
that you can organise your code into logically related ‘paragraphs’ complete
with their necessary declarations. This makes code much more maintainable –
you can easily move sections of code around, taking the necessary
declarations along at the same time. If you use the const modifier you can
also ensure that variables whose value should not change after it is first
calculated do not do so.

Double x,y; // Declare two variables
cin >> x >> y; // read in their values
const Double sqrtX = sqrt(x); // Calculate the square roots
const Double sqrtY = sqrt(y);
cout << sqrt(sqrtX+sqrtY);
sqrtX = 42; // Will give an error…

10: Classes provide extensible types, promoting code reuse. This can
result in major savings in the amount of code written. I saw a recent
article which stated that the new Taligent operating system, which is written
in C++, consists of 250,000 lines of code, whereas WindowsNT, written in C,
was said to consist of 4,000,000 lines of code.

View Answer on Quora

Popular Programming Languages


All popular programming languages, for each one the description and why to choose it. New emerging programming languages are also included in the list. 

Complete list

Description

Why use it?

C#
(C Sharp)
Concurrent to java, runs on .NET or compatible platforms (Portable NET, Mono). 
More
 – Code
Easier than C++. May share resources with other languages under a common runtime.
C C offers great freedom, and lot of debugging challenge thanks to pointers and memory management. 
More
 – Code
Suffering slow programming to make fast programs. For system programming.
C++ C++ is C plus objects, an extended library, templates. 
More
 – Code
System programming as C but allow larger project, or applications.
D language C++ like language, more dynamic. Compatible with C.
D Language – Code
For teaching or scripting.
Pascal Old language (1970), improved with objects, imposes a strictly structured programming. 
More
 – Code
Teaching, or client/server apps with Delphi and Kylix.
Basic
ASP
This very old language (1964) was improved by Microsoft, with a complete programming environment. Other portages exist. 
More
 – Code
Standard language for scripting Microsoft’s applications (Word etc…), and for dynamic web pages (Asp) on Windows servers.
PHP Designed to be embedded inside HTML to build dynamic Web pages or update them from databases.
More
 – Code
Producing HTML pages from data.
The version 5 targets Web services.
Java Was designed to be portable and to replace C++.
More – Code
Cross-platform applications. For web services and mobile phone apps under Android.
JavaScript,
ECMAScript
JavaScript has been invented to build dynamic client-side html pages, ECMAScript is the standardized version. 
More
 – Code
For interactivity in web pages and applications.
Used with HTML 5 for Web or local apps on Metro or Node.js or Qt.
Scriptol A simple, object-oriented, universal language with an intuitive and powerful syntax. You can build executables, or embed code into html pages.
XML may be used as data structure. 
More
 – Code
Easy and universal for scripting, prototyping, making binary applications, dynamic web pages and XML processing.
For web services by using PHP 5 as back-end.
Python A modern interpreted language with powerful built-in features and a unique indentation feature to shorten coding.
The Jython version compiles in Java bytecode. 
More
 – Code
Programming at light speed. Powerful and easy to learn.
Extending Zope for web services.
Java scripting with Jython.
Only for open source applications (not compiled).
Boo This is a new version of Python with some new features. It runs on .Net and Mono and thus, no compatibility problem.
Boo – Code
Similar to Python.
ASP Scripting language, server-side, for dynamic web pages by Microsoft, same syntax as Basic. 
ASP
 – Code
Producing HTML pages from data, but under Windows servers only.
Assembler This is near the machine language and the fastest. You should never use it, as older programmers did. Making graphic subroutines, drivers or industrial processing.
Eiffel, Sather Object-oriented, with “programming per contract” and other secure features. Sather is an open source implementation.
More – Code
Programming secured applications. Used by hospitals.
Perl A scripting interpreted language. Readabillity and ease of use are not the goal. 
Perl 
– Code
Mainly used by networks administrators and for small CGI scripts.
Rebol Interpreted language for network scripting. The language itself may be augmented. 
Rebol
 – Code
Processing information on distributed computer systems, with small programs.
Ruby Designed with simplicity in mind. It is interpreted, and has a proprietary but extensible library. 
More
 – Code
Writing scripts more easily. Using Ruby on Rails for Web applications.
Tcl A scripting language, easy to learn and available on any platform.
More – Code
Scripting of portable programs with GUI, and web programming by CGI.
NetRexx By IBM, has a simplified syntax. 
More
 – Code
Extends Java with scripts.
Lua Add-on or standalone language with extensible semantic.
Lua – Code
Extending the C language.
Cobol Business language still used on big computers.
Cobol – Code
Maintaining old programs on mainframes.
Fortran One of the first languages, always used for mathematical tasks.
Fortran – Code
Has huge library for scientific calculations.
Lisp Lisp is a very old language designed for artificial intelligence, processes lists only.
Lisp – Code
Artificial intelligence and scripting.
Scheme Scheme is a modernized version of Lisp.
Scheme – Code
Artificial intelligence and scripting.
Prolog For logic programming, based on Horn’s clauses.
Prolog – Code
Heavy artificial intelligence processing.
Haskell Functional programming. Slow and memory consuming. 
Haskell
 – Code
To try programming in another way
SQL Language of data management. 
MySQL
For databases queries.
Forth Another oldy. Invented by an astronomer, is stack based
Forth – Code
For instrumental commands and legacy libraries re-using.
Smalltalk One of the first object oriented language, programs can’t run outside the IDE.
Smalltalk – Code
Absolutely object-oriented processing.
Modula,
Oberon
Successors to Pascal.
Oberon – Code
For nostalgics of the Algol and Pascal time.
Caml, Ocalm Functional languages, Ocalm is object-oriented.
Caml – Code
Used by universities. May help to build a compiler.
Scala Procedural, functional and object-oriented programming language.
Scala – Code
Provides a more compact syntax than Java on the virtual machine
XML Not really a programming language, but may be used for similar tasks.
XML
XML serves to describe precisely data and may include actions on data.
XSL allows to transform documents.