Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Why is C++ so popular

Reply
Thread Tools

Why is C++ so popular

 
 
woodbrian77@gmail.com
Guest
Posts: n/a
 
      09-29-2012
On Saturday, September 29, 2012 2:27:04 AM UTC-4, Jorgen Grahn wrote:
> On Fri, 2012-09-28, Brian wrote:
>
> > Brian <(E-Mail Removed)> wrote:

>
> >> I have not found an answer to the question why C++ is the most preferred

>
> >> language. I thought it would be a good question to ask in this newsgroup

>
> >> that has programmers that have been using C++ for a while.

>
> >> I did read that its popular because it can be transferred to other

>
> >> platforms but not everyone has more than one platform.

>
> >

>
> > 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.
>



Are 90% of the people you mention who dislike C++ using C?
Perhaps it would help to think of it like the US Marines:
the few, the proud, the C++ programmers. My experience is
that some lonely times with C++ eventually pays off.


Brian
Ebenezer Enterprises -- making programming fun again.
http://webEbenezer.net
 
Reply With Quote
 
 
 
 
BGB
Guest
Posts: n/a
 
      09-29-2012
On 9/29/2012 5:44 AM, Brian wrote:
> BGB <(E-Mail Removed)> wrote:
>> On 9/28/2012 7:07 AM, Nick Keighley wrote:
>>> On Sep 28, 4:56 am, Brian <(E-Mail Removed)> wrote:
>>>> BGB <(E-Mail Removed)> wrote:
>>>>> On 9/27/2012 3:44 AM, Brian wrote:
>>>>>> I have not found an answer to the question why C++ is the most preferred
>>>>>> language. I thought it would be a good question to ask in this newsgroup
>>>>>> that has programmers that have been using C++ for a while.
>>>>>> I did read that its popular because it can be transferred to other
>>>>>> platforms but not everyone has more than one platform.
>>>>
>>>>> because it sucks less than the other options?...
>>>>
>>>>> many people tend to thing of things in terms of being "better" or "more
>>>>> preferable" (like there is some significant "good" that pulls people to a
>>>>> particular solution), but I suspect this may be backwards.
>>>>
>>>>> I suspect, instead, people tend to avoid serious drawbacks, and the
>>>>> option the with least serious drawbacks wins by default.
>>>>
>>>>> historically, both C and C++ have been in a fairly good spot here.
>>>>> this may be partly due to being reasonably free of crippling design flaws
>>>>> (or, at least real design flaws, as opposed to people complaining that it
>>>>> doesn't really follow idiom-X or fad-Y or prevents bad-practice-Z).
>>>>
>>>>> whereas, many other languages have had maybe a few nifty features, but
>>>>> often at the cost of being seriously crippled or broken in some other
>>>>> area (often denied, downplayed, or claimed to actually be a feature, by
>>>>> people who endorse the language...).
>>>>
>>>>> usually, this is not about idioms, but rather, things which impede using
>>>>> the language in one way or another (such as awkward or unreadable syntax,
>>>>> broken semantics, ...), or limit its effectiveness at performing an
>>>>> operation (such as arbitrary limitations, poor performance, tendency to
>>>>> misbehave or be overly difficult to debug, ...).
>>>>
>>>>> so, most people largely end up using what works...
>>>>
>>>>> though, this is not to say it is perfect either, for that matter...
>>>>
>>>> Delphi use to be popular because it had a good structure when writing code.
>>>> I have programmed in Visual Basic but after a while the structure starts to
>>>> look untidy with too many programming words and so the program flow can be
>>>> difficult to see. So I'm looking at other programming languages and notice
>>>> that many seem to follow C with the curly brackets etc.
>>>> If I were to ask software companies what language the program they are
>>>> selling in written in then I have a feeling the answer would be either C or
>>>> C++.
>>>
>>> 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.
>>
>>
>>>> There are many programming languages to chose from but for some reason
>>>> people seem to chose C++ maybe its the language that's taught in schools.

>>
>> 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?
>


in all, the language itself wasn't all that bad.

it was sort of like C++, but mostly lacking a few things like
multiple-inheritance and similar (not a big deal personally).

it is at least much more preferable than Java, where the core language
is pretty stripped-down and awkward, and most things that had been done
to expand on it have been via nasty kludges (with Sun/Oracle leaving the
internals hanging out).


main issues with C# were:
its ability to interface with C and C++ code was a little weak (but at
least, nowhere near as bad as Java);
it is built on top of .NET, which being a MS product, is only
well-supported (on Linux, there is Mono, but it isn't nearly as good or
well-integrated with the OS, 1).

also, .NET typically gets worse performance than native code on
benchmarks (including some other JITs, there are benchmarks where it is
being outperformed by the likes of Lua, Python, and Perl).


at least as-of a few years ago, it didn't have eval or ability to load
program-code from source-code form, ... however, since then both MS and
Mono have added (different) mechanisms to deal with this (in MS's case,
this is the Roslyn API).


1: on Windows, a person can just compile some code as C++/CLI, and have
fairly direct access both to C# land and to C and C++ land, and also
APIs exposed via C++/CLI code can be directly seen by C#.

similarly, LoadLibrary and similar can do a lot more magic (no real need
to worry about native-vs-managed libraries, ...).


on Mono, C++/CLI code doesn't work, leaving the only major (portable)
cross-language interface as P/Invoke (requires writing any structs or
function-prototypes in C#, and doesn't deal with the entire C type-system).

going the other way, requires linking against the Mono libraries, and
making use of a lot of Mono-specific API calls.

this wouldn't be as bad, except that Mono is a pain to get built on
Windows, and this would mean having to go through the hassle of having
two different sets of C# <-> C interfaces (one for MS's .NET, and
another for Mono).


I wouldn't mind things as much otherwise, and have written a few small
apps before using C#, but for my main projects, it is a problem, as I
basically have a large amount of code mostly written in C.


so, it was easier for me just to continue using/expanding my own
scripting language / VM (where the main advantage is mostly that I
control it, and can build it for whatever target I need it on, partly as
I don't really trust 3rd party dependencies).

the language isn't meant to "replace" C or C++ though, but rather to
address some use-cases which are weak areas for them, such as loading
scripts from source, ... (FWIW: dynamically compiling C code does not
make a very good scripting language... I have actually tried this...).


the main reason my script language ended up with a lot of ActionScript3
syntax was partly itself due to C#:
my script language was originally based on JavaScript;
C# had some features that I wanted, but the syntax wouldn't fit as well
on JS;
AS3 had a lot of similar features, but was also JS-based and had better
meshing syntax designs.

so, I ripped off a lot more of AS3's syntax (though the actual semantics
and feature-set are more varied).

(actually, the language reintroduces a lot of stuff from C as well, and
also has some C++ influenced features as well, ...).


for example, does it really matter the exact syntax used for, for
example, get/set properties, or overloaded operators, or more just that
the language has get/set properties and overloaded operators?...

example:
public int foo { get { return foo_i; } set { foo_i=value; } };
vs:
public function get foo():int { foo_i }
public function set foo(value:int) { foo_i=value; }

likewise:
public function operator+(x:Foo, y:Foo):Foo { x.add(y) }


both the JVM and .NET have had some influences on the VM architecture as
well though. (not feeling like going too much into specifics at the
moment though, and doubt that it is all that relevant...).


not that I expect anyone else would want to use it, this is just how
things go.


or such...

 
Reply With Quote
 
 
 
 
BGB
Guest
Posts: n/a
 
      09-29-2012
On 9/29/2012 6:23 AM, Brian wrote:
> Jorgen Grahn <(E-Mail Removed)> wrote:
>> On Fri, 2012-09-28, Brian wrote:
>>> Brian <(E-Mail Removed)> wrote:
>>>> I have not found an answer to the question why C++ is the most preferred
>>>> language. I thought it would be a good question to ask in this newsgroup
>>>> that has programmers that have been using C++ for a while.
>>>> I did read that its popular because it can be transferred to other
>>>> platforms but not everyone has more than one platform.
>>>
>>> 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.)

>
> 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.



no, it does not.

Java can run in a browser, but more often, it is used for standalone apps.


 
Reply With Quote
 
BGB
Guest
Posts: n/a
 
      09-29-2012
On 9/29/2012 12:26 PM, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> On Saturday, September 29, 2012 2:27:04 AM UTC-4, Jorgen Grahn wrote:
>> On Fri, 2012-09-28, Brian wrote:
>>
>>> Brian <(E-Mail Removed)> wrote:

>>
>>>> I have not found an answer to the question why C++ is the most preferred

>>
>>>> language. I thought it would be a good question to ask in this newsgroup

>>
>>>> that has programmers that have been using C++ for a while.

>>
>>>> I did read that its popular because it can be transferred to other

>>
>>>> platforms but not everyone has more than one platform.

>>
>>>

>>
>>> 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.
>>

>
>
> Are 90% of the people you mention who dislike C++ using C?
> Perhaps it would help to think of it like the US Marines:
> the few, the proud, the C++ programmers. My experience is
> that some lonely times with C++ eventually pays off.
>


in my case, I am more of a C developer, but also use C++ somewhat.

the main merit C++ has is that it has a lot of features beyond those
available in plain C.


the main drawback C++ has is that the syntax, language features, and
ABI, are sufficiently complex to make low-level interfacing at this
level problematic (it is much easier to write tools that can parse and
work with C than deal with C++ at its own level).

(it is easier for "mere mortals" to write a reasonably correct C parser
than for them to write a reasonably correct C++ parser...).


historically, there were often problems with GNU G++ as well, ...


there are also differences with compilation speeds (C++ code compiling
slower than C code), ... (not exactly like C code compiles quickly
either... but shaving down compile times may be relevant...).


so, even if the code is not as pretty sometimes, C may still be a plenty
usable option.

a lot depends on tradeoffs...


or such...

 
Reply With Quote
 
BGB
Guest
Posts: n/a
 
      09-29-2012
fix/add:
C# is more sort of "part-way" between Java and C++.
semantically, it is more like Java, but some syntactic elements more
resemble those in C++.


>
> main issues with C# were:
> its ability to interface with C and C++ code was a little weak (but at
> least, nowhere near as bad as Java);
> it is built on top of .NET, which being a MS product, is only
> well-supported (on Linux, there is Mono, but it isn't nearly as good or
> well-integrated with the OS, 1).
>


correction: well-supported on Windows...

its support on Linux kind of sucks...


 
Reply With Quote
 
Ian Collins
Guest
Posts: n/a
 
      09-29-2012
On 09/29/12 23:23, Brian wrote:
>
> 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.


Most software (excluding Web applications) today doesn't use buttons on
forms, nor does it run on windows.

--
Ian Collins
 
Reply With Quote
 
Jorgen Grahn
Guest
Posts: n/a
 
      09-29-2012
On Sat, 2012-09-29, (E-Mail Removed) wrote:
> On Saturday, September 29, 2012 2:27:04 AM UTC-4, Jorgen Grahn wrote:

....
>> 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.

>
> Are 90% of the people you mention who dislike C++ using C?


Unix C programmers, yes. There's some kind of sibling rivalry
going on. And some semi-rational reasons too: we've all seen
atrocious C++ code.

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
 
Reply With Quote
 
Rui Maciel
Guest
Posts: n/a
 
      09-29-2012
Jorgen Grahn wrote:

> Unix C programmers, yes. There's some kind of sibling rivalry
> going on. And some semi-rational reasons too: we've all seen
> atrocious C++ code.


Seeing atrocious code is no excuse to hate the language. If you showed them
atrocious C code, I bet they wouldn't think differently of C. A programming
language is, in that aspect, just like any foreign language: it isn't
automatically better or worse just because someone is seen saying silly
things in it.


Rui Maciel
 
Reply With Quote
 
Ian Collins
Guest
Posts: n/a
 
      09-29-2012
On 09/30/12 11:00, Rui Maciel wrote:
> Jorgen Grahn wrote:
>
>> Unix C programmers, yes. There's some kind of sibling rivalry
>> going on. And some semi-rational reasons too: we've all seen
>> atrocious C++ code.

>
> Seeing atrocious code is no excuse to hate the language. If you showed them
> atrocious C code, I bet they wouldn't think differently of C. A programming
> language is, in that aspect, just like any foreign language: it isn't
> automatically better or worse just because someone is seen saying silly
> things in it.


In kernel land bigotry and FUD are big players.

--
Ian Collins
 
Reply With Quote
 
Rui Maciel
Guest
Posts: n/a
 
      09-29-2012
BGB wrote:

> the main merit C++ has is that it has a lot of features beyond those
> available in plain C.


Conversely, if we would start to discuss which features are missing from the
C programming language, while completely ignoring C++, we would end up with
a list of features which, when implemented, would've pushed the C
programming language closer to C++. For example, the type-generic
expressions introduced in C11 look like someone desperately wanted the C
programming language to support generic programming but did their best to
avoid introducing C++ templates to C.


Rui Maciel
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
Why is OO popular? Ian Roberts C++ 5 04-20-2004 05:30 AM
Are Dvd-R more popular then the +? Why? lbbs DVD Video 29 01-11-2004 02:14 PM
Are Dvd-R more popular then the +? Why? lbbs Computer Support 9 01-08-2004 12:24 AM



Advertisments