Why your next language better be C++

L

Lynn McGuire

Why your next language better be C++:
http://www.i-programmer.info/profes.../2674-why-your-next-language-better-be-c.html

"It looks as if the war between C++ and C# is over
and C++ has won."

"If I was asked to write an advertising poster for C++
it would go something like:

"Do you want to write applications that run directly on
the CPU without interpreters or VMs getting in the way?"

"Do you want make use of the operating system interfaces
as if you owned them?"

"Do you want to use a language that isn't going to be
crippled by an evil proprietor?"

"Then you need C++"

Lynn
 
P

Paul

Lynn McGuire said:
Why your next language better be C++:

http://www.i-programmer.info/profes.../2674-why-your-next-language-better-be-c.html

"It looks as if the war between C++ and C# is over
and C++ has won."
C# was never a rival of C++, it sounds crazy but its biggest rival was VB :)
"If I was asked to write an advertising poster for C++
it would go something like:

"Do you want to write applications that run directly on
the CPU without interpreters or VMs getting in the way?"

"Do you want make use of the operating system interfaces
as if you owned them?" I take it you mean API's here.

"Do you want to use a language that isn't going to be
crippled by an evil proprietor?"

"Then you need C++"
C# is ok if you are a C, C++ or Java programmer and you find yourself in
dotnet environment. Its quite easy to pick up because its syntaxically
similar. When MS made a big push with the dotnet framework they needed to
accomodate for non VB'ers for it to appeal to a wider market so they
invented C# to accompany the dotnet framework. The thing I didn't like about
it all was that VB for applications didnt evolve to allow the use of C# ,
which would've been nice for doing fancy stuff with excel spreadsheets. If
they'd done this I would've kept using C# , but as it was I only found it
usefull for doing dotnet assemblies which I used for Business logic between
Database and ASP's. I guess it would only be any use if you were a windows
server porgrammer of sorts, which I'm not, so I have a couple of partially
read books lying in the bottom of a cupboard someplace since the big dotnet
thing came along. Oh yes and the MSDN subscriptions that we had for doing
that project did not come cheap, VS.net pro edition was about £800 when it
first came out.

Its not comparable to C++, but it was more fun to learn probably because of
more productivity. :)
 
G

Goran

"Do you want to write applications that run directly on
the CPU without interpreters or VMs getting in the way?"

Nobody should care whether an app run directly on the CPU. There's
nothing wrong with a VM per se. There's lots wrong in certain
scenarios, just like there's lots wrong with absence of VM in other
scenarios.
"Do you want make use of the operating system interfaces
as if you owned them?"

Any language can make use of OS interfaces, because OS interface
always boils down to C, and any language has "foreign function
interface" that binds to C (or at worst, C++, needing a C++ wrapper
for a C library). This argument is, rather: do you need to make a lot
of OS calls? That's most easily done with C an C++ and you'd be
hampered using something else.
"Do you want to use a language that isn't going to be
crippled by an evil proprietor?"

There's lots of languages that don't have an evil proprietor. In fact,
I am not sure that C# has an evil proprietor (AFAIK, CLR and C# spec
are ECMA standards). I think, at best you can say that C# has an evil
__implementor__.
"Then you need C++"

IMHO, current state of affairs is that for many applications,
__sticking to one language__ is the worst thing to do. For example,
there's a very slim chance that you'll be writing C++ code that runs
inside a browser (or inside an HTTP server). Or whatever.

Goran.
 
B

BGB


sadly, matters are not this simple.

admittedly, C is my main-used language, although C++ and ASM are also in
my top 3, probably with my own custom language (BGBScript, presently
most similar to ActionScript) in 4th place, and Java in 5th place.

"It looks as if the war between C++ and C# is over
and C++ has won."

possibly, both C++ and C# have merits do, and each can be used for
things which are problematic in the other.

ultimately, although more work may be needed to do some things in C or
C++, there is a little less of a problem with running into a "glass
ceiling" as in C# or Java.

"If I was asked to write an advertising poster for C++
it would go something like:

"Do you want to write applications that run directly on
the CPU without interpreters or VMs getting in the way?"

VMs in turn have good and bad points.

I wouldn't want to be stuck in a world where I *had* to use a VM as the
primary/sole development environment, however, VMs still have merits
which make their use worthwhile in addition to native code.


a recent idea of mine (revived from an older idea of mine from 2009) is
to use a modified/fudged version of x86 machine code in a VM (the design
was altered slightly to make it better suited to a VM interpreter/JIT
and to variable address-word sizes).

a proof-of-concept would be to use it on an ARM-based target.

I already have a plain x86 interpreter (from 2009 or so) which I have
successfully tested on ARM, however, what I was imagining above would be
technically different (it would operate much closer to the metal,
operating in the same address space and with likely sharing data
structures/... with the native code, whereas the existing interpreter
uses virtual address spaces and a partially synthesized "OS").

sadly, I have many more important things to do, so may not have time to
do much with this idea...


note that most of my other stuff is built on other, more specialized,
bytecode formats (high-level bytecodes, whereas a modified x86 variant
would be more of a lower-level byte code).

"Do you want make use of the operating system interfaces
as if you owned them?"

any VM with a competent FFI should allow this, although sadly many HLL
VMs (including the JVM) have been relatively incompetent at doing this
"well" (for example, Java tends to require much evil boilerplate, as do
the majority of existing HLL VMs AFAICT).

..NET does a little better.

in my case, I have managed to largely gloss over this issue (typically,
relatively little boilerplate is needed). I have wondered though why
others have not done so, as the problems are not *that* hard, and it is
not like I have corporate levels of developer resources at-hand.


say, we devide FFIs into levels:

level 1: no real FFI, stuff is hard-coded into or registered with the VM
or similar and may have to deal with VM internals and/or complex
interfacing rules;

level 2: one writes boilerplate in C or C++, but the VM can locate the
functions on its own (for example, JVM with JNI);

level 3: one writes boilerplate or signatures in the HLL, but the VM
manages the native calls (Java JNA, .NET P/Invoke, ...);

level 4: one uses a tool which reads C or C++ headers and similar and
spews out the boilerplate (for example, Swig);

level 5: one references the headers, with any needed glue-code being
generated on-the-fly and behind-the-scenes.

level 6: there is no noticeable seam (code running inside and outside
the VM is indistinguishable, and cross-language interfaces are entirely
transparent).


my own VM is presently mostly at around 4.5, where a tool is needed to
process the C headers, but this was mostly for performance reasons
(processing the C headers during program startup was relatively
expensive, and would require keeping them around). however, most
interface code is dynamically generated (calls to C are automatic, but
direct calls from C or C++ may require generated stubs).

"Do you want to use a language that isn't going to be
crippled by an evil proprietor?"

"Then you need C++"

fair enough.

C# is, theoretically standardized, but MS currently holds the only
really "good" implementation.

Mono is not nearly as good, and is IMO written on some of the most nasty
code I have probably ever seen (it could use some level of code-cleanup
and fixing up its overall architecture).

most other implementations are far less feature-complete.


Java is a little better on this front in that it tends to have more
mature open-source implementations, at the cost of Java itself being a
"not very impressive" language.


ultimately, I much rather write code mostly in C and C++, and develop my
own technology for what doesn't work as well in C or C++.

granted, it is probably not like my own VM technology would be winning
any awards any time soon anyways.


or such...
 
B

Bo Persson

Goran said:
There's lots of languages that don't have an evil proprietor. In
fact, I am not sure that C# has an evil proprietor (AFAIK, CLR and
C# spec are ECMA standards). I think, at best you can say that C#
has an evil __implementor__.

The evil implementor also wrote the standards, which is a real
limitation.

Any day they feel like it, they can provide an "improved standard" for
ECMA to rubber stamp. Or implement it anyway.


Bo Persson
 
N

Noah Roberts

IMHO, current state of affairs is that for many applications,
__sticking to one language__ is the worst thing to do. For example,
there's a very slim chance that you'll be writing C++ code that runs
inside a browser (or inside an HTTP server). Or whatever.

There's actually a fairly nice C++ API for doing that now. I gather it
has all the nice bells and whistles that people who write web
applications need. I've played with it a little bit. Implements drag
and drop as well as a bunch of other stuff. Uses Boost.Signals to
implement event processing. It's almost exactly like writing a normal
application.
 
L

Lynn McGuire

"Do you want to use a language that isn't going to be
There's lots of languages that don't have an evil proprietor. In fact,
I am not sure that C# has an evil proprietor (AFAIK, CLR and C# spec
are ECMA standards). I think, at best you can say that C# has an evil
__implementor__.

This blog is talking about the battle between C# and C++.
IMHO, current state of affairs is that for many applications,
__sticking to one language__ is the worst thing to do. For example,
there's a very slim chance that you'll be writing C++ code that runs
inside a browser (or inside an HTTP server). Or whatever.

All of my http server side code is in C++. I have some
fairly large (200+ MB) databases and I need all the speed
that I can get.

Lynn
 
J

James Kanze

"It looks as if the war between C++ and C# is over
and C++ has won."

More idiot ramblings., There was never a war between C++ and
C#, so there can't be any winner or looser. The languages
address different problems: C# isn't actually that bad---for
what it is designed to do. C++ is better, for what it was
designed to do (and that's a lot of things) than any of the
alternatives; most of the other languages one sees today are
designed for much smaller niches, where they're often very good.
(We use C++, C#, Java, Python, and Perl, in different places.
Not to mention GMake, Solution and project files, etc., etc.)
 
J

JBarleycorn

James said:
More idiot ramblings., There was never a war between C++ and
C#, so there can't be any winner or looser.

Since I have eval'd C# as a potential replacement for my use of C++ I am
sure that many others have also. Just because C++ has low-level
capabilities, that doesn't mean you have to use it that way. If not a
war, a battle for sure. Idiots are people who think they know everything.
 
L

Lynn McGuire

More idiot ramblings., There was never a war between C++ and
C#, so there can't be any winner or looser. The languages
address different problems: C# isn't actually that bad---for
what it is designed to do. C++ is better, for what it was
designed to do (and that's a lot of things) than any of the
alternatives; most of the other languages one sees today are
designed for much smaller niches, where they're often very good.
(We use C++, C#, Java, Python, and Perl, in different places.
Not to mention GMake, Solution and project files, etc., etc.)

If you read Microsoft publications then they sure have
been presenting C# as a successor to C++. Several of the
articles implied that the System people were totally
rewriting Windows in C#. Looks like the System and
Office people totally ignored the Language people or won
all the battles.

Lynn
 
R

Rui Maciel

BGB said:
possibly, both C++ and C# have merits do, and each can be used for
things which are problematic in the other.

ultimately, although more work may be needed to do some things in C or
C++, there is a little less of a problem with running into a "glass
ceiling" as in C# or Java.

And planned obsolescence. Let's not forget the ever-present planned
obsolescence problem associated with using non-standardized, proprietary,
tightly controlled software development tools.


Rui Maciel
 
R

Rui Maciel

Goran said:
There's lots of languages that don't have an evil proprietor. In fact,
I am not sure that C# has an evil proprietor (AFAIK, CLR and C# spec
are ECMA standards). I think, at best you can say that C# has an evil
__implementor__.

The current version of C# is 4.0, while the last version of C# which has
been covered by a standardization attempt was C# 2.0, back in 2006. As C#
developers tend to develop their software based on the features which are
provided by their copy of Microsoft Visual Studio instead of what has been
standardised, I don't believe it is reasonable to assume C# as being
something other than a proprietary programming language implemented through
a proprietary software product. And even when some third-party
implementation tries to implement some non-standard feature provided only by
Microsoft through Microsoft's products then we have to deal with patent
threats.


Rui Maciel
 
E

Ebenezer

More idiot ramblings.,  There was never a war between C++ and
C#, so there can't be any winner or looser.  The languages
address different problems: C# isn't actually that bad---for


They've spent billions on it to make sure it
doesn't suck too bad.

what it is designed to do.  C++ is better, for what it was
designed to do (and that's a lot of things) than any of the
alternatives; most of the other languages one sees today are
designed for much smaller niches, where they're often very good.
(We use C++ :>

, C# :|

, Java :(

, Python :}

, and Perl
:|


Brian Wood
Ebenezer Enterprises
http://webEbenezer.net
 
B

BGB

And planned obsolescence. Let's not forget the ever-present planned
obsolescence problem associated with using non-standardized, proprietary,
tightly controlled software development tools.

well, this is (slightly) less of a problem with Java, as developer tools
are available from several sources:
the Sun/Oracle JDK;
IBM; Eclipse; GCJ; ...

for C#, there are also the Mono and .GNU compilers, but the problem for
them is if one compares them with the MS tools, they sort of fall on
their face.

but, yes, if either Oracle or MS pulled official support for the
languages, it is unclear if the community would remain, or if it would
all start to erode relatively quickly, given how closely the languages
are associated with their parent companies.


misc:

in fact, I have my own parser support for for both Java and C#, but if I
will use them for much is uncertain.

most of my recent activity is focusing on my BGBScript language, which
uses a different parser and compiler backend, as well as a different AST
format (BGBScript uses S-Expression/List based ASTs, whereas my C / Java
/ C# / BS2 frontend uses XML/DOM-based ASTs, and a compiler which
produces a different IL).

ultimately, I am having to shrink the scope of my projects some, as my
effort was spread to thin (and most of the parts originally intended for
my Java and BS2 efforts have since ended up being migrated over to BS).

probably most of my existing Java code will end up ported to BS as well.

or such...
 
M

Michael DOUBEZ

More idiot ramblings.,  There was never a war between C++ and
C#, so there can't be any winner or looser.  The languages
address different problems: C# isn't actually that bad---for
what it is designed to do.  C++ is better, for what it was
designed to do (and that's a lot of things) than any of the
alternatives;

I am rather tempted by the D programming language. Especially the
syntax which is IMO more readable and have intersting features (in
particular threads not sharing mutable data by default).
most of the other languages one sees today are
designed for much smaller niches,

IMO it is a 3 vs 4 generation language issue. At a few exception, all
of them claim to be (the new) general purpose programming language.

Not to mention the 5thGL with our lisp and prolog friends users that
have found the truth but still have to endure this world.
where they're often very good.
(We use C++, C#, Java, Python, and Perl, in different places.
Not to mention GMake, Solution and project files, etc., etc.)

{same as Ebenezer :)}
 
J

James Kanze

(e-mail address removed):
There is a lot of C++ code running inside our HTTP server (also written in
C++). To be honest, there is also a lot of script code running inside the
HTTP server, but the script language interpreter and many of its functions
are implemented in C++ again.

From what I've seen recently, the usual model seems to be to
provide components written in C++ to do the "hard" work (heavy
maths, data manipulation, etc.), and use other languages to glue
the components together.
 
J

James Kanze

Since I have eval'd C# as a potential replacement for my use of C++ I am
sure that many others have also.

There are certainly things that one might have written in C++
some years ago, and that one would perhaps write in Java or C#
today. But C# isn't really applicable for most of what C++
does.
Just because C++ has low-level
capabilities, that doesn't mean you have to use it that way.

It has nothing to do with low level capabilities, and everything
to do with the ability to manage large projects, over multiple
platforms.
If not a war, a battle for sure.

There was never a battle, because C# never tried to be what C++
is: a portable language for large scale applications.
 
J

Jorgen Grahn

.
but, yes, if either Oracle or MS pulled official support for the
languages, it is unclear if the community would remain, or if it would
all start to erode relatively quickly, given how closely the languages
are associated with their parent companies.

To be fair, if the GCC people started mistreating g++, I'm not sure I
would stick around. (Not that they are likely to.)

/Jorgen
 
B

Bo Persson

Lynn said:
If you read Microsoft publications then they sure have
been presenting C# as a successor to C++. Several of the
articles implied that the System people were totally
rewriting Windows in C#. Looks like the System and
Office people totally ignored the Language people or won
all the battles.

That's marketing, what does that have to do with anything?


Bo Persson
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top