Why is C++ so popular

B

Bart Vandewoestyne

2) My favorite reason is: because C++ is *alive* ! I don't know no other
language that has changed so much over time.

I do. It's definitely not my intention to be a troll and start a programming language war here, but don't forget Fortran with its different revisions: FORTRAN77, Fortran 90/95, Fortran 2003,...

During my PhD I've been programming for 5 years in Fortran 95. For the scientific work that I needed to to, it just rocked!

Now I switched to industry and I am learning C++ for about one year. It's also an interesting journey... lots of stuff to learn!

What language do I prefer? None. I just pick the right tool for the right job!

Regards,
Bart
 
R

Rui Maciel

Brian said:
Most of those surveys seem to have C++ at or near the top of the list.
To put it another way why should C++ be more popular than Visual Basic as
Visual Basic is easy to learn and there is less code to write?

Because you can actually get work done with C++, or any other language, and
you don't risk having to throw it all down the toilet, both your work and
your knowledge, whenever Microsoft decides to release a new version of VB.

In addition, I suspect that Visual Basic's main virtue, and maybe the only
one, is that it's there. If Microsoft didn't force-fed Visual Basic as the
company's pet scripting language then I don't believe it would even be in
the radar. Alternative scripting languages, such as lua, python and perl,
don't have a monopoly-holding corporation pushing them everywhere and they
still manage to be incomparably more popular than Visual Basic. There is
certainly a good reason for that.


Rui Maciel
 
B

BGB

yes but that's just a feeling. Complex products are often programmed
in a variety of languages. Languages like Python and Ruby are quick to
develop in but sometimes run rather sluggishly. C++ can be used in the
important bits to make everything go faster. Java is pretty popular as
is C#. Though you might see them as having a C-like syntax.

yeah.

multi-language projects are common, and people don't usually like being
tied to a particular target OS.

my own project is composed presently mostly of C (first-place), C++ (2nd
place), and BGBScript (3rd place), with the latter being a custom
language loosely based on JavaScript and ActionScript 3.0 (and mostly
follows ECMA-262, but currently it differs mostly on minor things).

(yes, the BGBScript VM is itself roughly 700,000 lines of mostly C...
the languages' main feature though is mostly that it has a "better than
usual" C FFI, I partly took the C++ ' extern "C" ' mechanism more as a
model for how an FFI should behave, although the actual mechanisms are a
bit different).


but, yes, JavaScript and ActionScript can also be seen as having a
C-like syntax.

I suspect this syntax style is fairly mainstream at this point.

and the syntax is basically less constraining than a line-oriented
syntax. the ever popular ';' mostly serving to indicate the end of a
statement, though languages like JS and friends make it optional, being
able to interpret either ';' or a linebreak as the end of a statement,
but ';' is usually still used as a matter of convention.


at least for myself, I learned C and C++ on my own.

I actually learned QBasic originally (on my own), but then learned
assembler, and originally moved into C land by working backwards from
the ASM output to figure out better how the source language worked.

the move was mostly because I ran into a "glass ceiling" with QBasic,
and so went on to a language which could "actually do stuff".

I went to colleges (many years later), but they were mostly using VB and
C# and similar. (can't say I "learned" much from college classes,
although I was originally exposed to JS via such a class, which was
mostly a class for HTML using it for interactive web-forms, so it wasn't
all bad...). (but, yes, all of this was many years ago now...).

or such...
 
B

BGB

only until you start doing real work (ie. non-GUI). As poited out
before Visual Basic is totally tied to Windows.

yeah, and the pointy-clicky Windows-specific GUI-building stuff is also
available for other languages as well, like C#, and C++.

this means, if they want, they can still do the front-end with
pointy-clicky, and choose a language that "actually works" for writing
the program logic.

granted, for my personal uses I haven't seen much reason to be tied to
Windows for sake of point-and-click GUI building, but understandably it
is a bit more convenient than building UIs via OpenGL, which is more
often how I have ended up doing it...
 
B

BGB

GUI heavy Windows apps

and where people don't feel like just using Visual Studio to spit out
gobs of C++ (using MFC), or C++/CLI code (using WinForms), and go from
there...

in either case, it is rapid pointy-clicky building of Windows-specific
GUI apps.
 
W

woodbrian77

A few years ago, some surveys indicated that about 50% of the enterprise

code was still written in COBOL. The standard has progressed through

COBOL68, COBOL74, COBOL85 and COBOL2004, and the next standard should be available

in a couple of years.

On Dice
http://dice.com
I found six hundred and some jobs when searching
for Cobol. There were over six thousand jobs when
searching for C++.

I used to know of some using Cobol, but today
I can't think of anyone who uses it.

Brian
Ebenezer Enterprises
http://webEbenezer.net
 
L

Lynn McGuire

I ask myself why should people program in C++ when Visual Basic is easier
to understand?
There must be a reason why C++ is chosen when there are many other
languages to chose from.
Maybe some people grow up with C and then moved on to C++ and its close to
what they had used in the past.

Try a large project in Visual Basic. Our software
products have about 800,000 lines of C++ and 600,000
lines of F77. The C++ is the most maintainable and
reliable code.

Lynn
 
L

Lynn McGuire

I do. It's definitely not my intention to be a troll and start a programming language war here, but don't forget Fortran with its different revisions: FORTRAN77, Fortran 90/95, Fortran 2003,...

During my PhD I've been programming for 5 years in Fortran 95. For the scientific work that I needed to to, it just rocked!

Now I switched to industry and I am learning C++ for about one year. It's also an interesting journey... lots of stuff to learn!

What language do I prefer? None. I just pick the right tool for the right job!

Regards,
Bart

It is very difficult to get old F77 code to work
properly in the new Fortran compilers. C++ does
not have the same problem.

Lynn
 
C

Cholo Lennon

only until you start doing real work (ie. non-GUI). As poited out
before Visual Basic is totally tied to Windows.

.... and (very important) it's a proprietary language.
 
C

Cholo Lennon

Again with this TIOBE nonsense. Using the tiobe index to base any claim on
the popularity of a programming language makes as much sense as searching
for the name of a programming language on youtube, and claiming that it is
more popular than another because the search returned more hits. Because
that's precisely how the the people behind TIOBE rank programming languages.

I completely agree with you. BTW people have to understand that the most
popular language (according to TIOBE) != the most used language
(example: Objective C over C++)

Regards
 
L

Lynn McGuire

Try compiling the Cfront 3.0 sources with a modern compiler... :)

s

Wasn't the cfront written in c code ?

I have C++ code from the early 1990s that has
not been touched in 20 years and still compiles
just fine.

Try old F66 and F77 code that assumes that all
variables (local and global) are initialized to
zero when the program starts up.

Lynn
 
J

Jorgen Grahn

Correct me if I'm wrong but I see some programming languages as having
restrictions such as if I wanted to colour a ball then I might only have
the colours that the programing language offers me ....
Maybe languages like C++ gives the programmer more
scope to design exactly what the programmer wants.

I think the most important thing you're missing is availability.
You've mentioned Visual Basic several times in this thread, but in my
world (Unix) it simply doesn't exist as a choice.

If you concentrate on languages which:
- are useful on all major platforms
- have free implementations, so others can compile/change your code
without paying first
- have a decent user base, so you can learn from others, and maybe
use it for a living
- are somewhat general-purpose (i.e. isn't JavaScript)

then the available languages are quite few: C, C++, Java(?), Perl,
Python, Ruby ... Some of the functional languages: Haskell, Erlang,
maybe LISP/Scheme. (I have certainly forgotten a few here; no need
to point them out.)

In my Unix/embedded part of the world, C++ isn't very popular. I meet
a lot of people who loudly dislike C++, and just a few who use it. The
company I work for even had a ban on its use, because of some failed
project in the 1990s.

Perhaps C++ appears popular to you because you look at what's trendy
in the Windows world right now?

Personally I believe C++ /should/ be popular, because it fits my
criteria above, and is better than C.

/Jorgen
 
B

Brian

BGB said:
yeah.

multi-language projects are common, and people don't usually like being
tied to a particular target OS.

my own project is composed presently mostly of C (first-place), C++ (2nd
place), and BGBScript (3rd place), with the latter being a custom
language loosely based on JavaScript and ActionScript 3.0 (and mostly
follows ECMA-262, but currently it differs mostly on minor things).

(yes, the BGBScript VM is itself roughly 700,000 lines of mostly C... the
languages' main feature though is mostly that it has a "better than
usual" C FFI, I partly took the C++ ' extern "C" ' mechanism more as a
model for how an FFI should behave, although the actual mechanisms are a bit different).


but, yes, JavaScript and ActionScript can also be seen as having a C-like syntax.

I suspect this syntax style is fairly mainstream at this point.

and the syntax is basically less constraining than a line-oriented
syntax. the ever popular ';' mostly serving to indicate the end of a
statement, though languages like JS and friends make it optional, being
able to interpret either ';' or a linebreak as the end of a statement,
but ';' is usually still used as a matter of convention.



at least for myself, I learned C and C++ on my own.

I actually learned QBasic originally (on my own), but then learned
assembler, and originally moved into C land by working backwards from the
ASM output to figure out better how the source language worked.

the move was mostly because I ran into a "glass ceiling" with QBasic, and
so went on to a language which could "actually do stuff".

I went to colleges (many years later), but they were mostly using VB and
C# and similar. (can't say I "learned" much from college classes,
although I was originally exposed to JS via such a class, which was
mostly a class for HTML using it for interactive web-forms, so it wasn't
all bad...). (but, yes, all of this was many years ago now...).

or such...

With your class experience with C# did you find that it was a cut down
version of C++ or would you describe it in a different way?
 
B

Brian

Jorgen Grahn said:
I think the most important thing you're missing is availability.
You've mentioned Visual Basic several times in this thread, but in my
world (Unix) it simply doesn't exist as a choice.

If you concentrate on languages which:
- are useful on all major platforms
- have free implementations, so others can compile/change your code
without paying first
- have a decent user base, so you can learn from others, and maybe
use it for a living
- are somewhat general-purpose (i.e. isn't JavaScript)

then the available languages are quite few: C, C++, Java(?), Perl,
Python, Ruby ... Some of the functional languages: Haskell, Erlang,
maybe LISP/Scheme. (I have certainly forgotten a few here; no need
to point them out.)

From what I understand a program written in Java needs a web browser to run
it and I think that might be true for some other languages. However I could
be wrong.
 
B

Brian

Lynn McGuire said:
Try a large project in Visual Basic. Our software
products have about 800,000 lines of C++ and 600,000
lines of F77. The C++ is the most maintainable and
reliable code.

Lynn

What is F77?
Are you saying that C++ has less lines of code than Visual Basic or because
they are large they are easier to maintain than Visual Basic?
 
B

Brian

BGB said:
yeah, and the pointy-clicky Windows-specific GUI-building stuff is also
available for other languages as well, like C#, and C++.

this means, if they want, they can still do the front-end with
pointy-clicky, and choose a language that "actually works" for writing the program logic.

granted, for my personal uses I haven't seen much reason to be tied to
Windows for sake of point-and-click GUI building, but understandably it
is a bit more convenient than building UIs via OpenGL, which is more
often how I have ended up doing it...

I am wondering how else to you write a program that uses buttons on forms
which most programs use these days without
using the run time library (or what ever its called) that Windows provides.
 
M

Miquel van Smoorenburg

I think the most important thing you're missing is availability.
You've mentioned Visual Basic several times in this thread, but in my
world (Unix) it simply doesn't exist as a choice.

If you concentrate on languages which:
- are useful on all major platforms
- have free implementations, so others can compile/change your code
without paying first
- have a decent user base, so you can learn from others, and maybe
use it for a living
- are somewhat general-purpose (i.e. isn't JavaScript)

then the available languages are quite few: C, C++, Java(?), Perl,
Python, Ruby ...

Actually, there is sort of a visual basic for unix, that meets
most of your requirement .. http://gambas.sourceforge.net/

Mike.
 
B

BGB

I am wondering how else to you write a program that uses buttons on forms
which most programs use these days without
using the run time library (or what ever its called) that Windows provides.

wrapper libraries is one option...

or, target-specific code that is optionally-used (this means, some
Windows-specific code, some Linux-specific code, some OSX-specific code,
....). the application then uses the particular code as appropriate for a
particular target OS, with the rest of the application-code being target
neutral.


or, using something like OpenGL to draw your own forms and buttons, and
then writing the code to process user input for them (this can make the
GUI code reasonably OS independent, and also allows better interaction
between the UI and any 3D-rendering going on).

basically, a person writes their own GUI widget code, which manages
drawing the widgets, checking mouse/keyboard events and figuring out
where the user was/is clicking, and generating/forwarding the
appropriate events, ...


or, ...

so, there are lots of options.
 
L

Lynn McGuire

What is F77?
Are you saying that C++ has less lines of code than Visual Basic or because
they are large they are easier to maintain than Visual Basic?

F77 is Fortran 77.

I am saying that C++ is more maintainable than
VB is for large projects.

Lynn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top