survival of c++

J

jimmy

I am presently working in C++ .It is flexible and efficient.But it is
not the reasons for the language to survive as hardware is running
ahead the capabilities of software(why efficiency?).Java is a cool
language and .NET too even for mobile devices and embedded
systems.Anybody can give some valid reasons so that I can understaand
C++ will survive in the coming years.
 
I

Ioannis Vranos

jimmy said:
I am presently working in C++ .It is flexible and efficient.But it is
not the reasons for the language to survive as hardware is running
ahead the capabilities of software(why efficiency?).Java is a cool
language and .NET too even for mobile devices and embedded
systems.Anybody can give some valid reasons so that I can understaand
C++ will survive in the coming years.



A useful information here is that there is an upcoming standard for
C++/CLI extensions.


Here are parts of a message I sent in another newsgroup:




Today in .NET with C++ we work in this way:


__gc class whatever
{
// ...
};


// Equivalent to whatever *p=__gc new whatever;
whatever *p=new whatever;


// Managed type in non GC heap
whatever *p=__nogc new whatever;


class whatever
{
// ...
};

// Here not garbage collected
whatever *p=new whatever;





With the new syntax:


ref class whatever
{
// ...
};


whatever ^p=gcnew whatever;


// This will be managed type in non GC heap
whatever *p=new whatever;



Also it is possible:


// GC object (working as if it is) in the stack.
// It is destroyed at the end of its scope
// (deterministic finalisation)
whatever x;



C++/CLI *is* more natural.



With C++ it is possible to do more things than with C#, since you can
work in the managed and unmanaged worlds combined.



C++/CLI does not replace ISO C++, it is a set of extensions to ISO C++.

One can also use ISO C++ for .NET applications (I do!). I am programming
in mixed mode, which is the most efficient and portable - portability
regarding C++ code recompiling only. I do not care for portability of
the compiled .exe to another platform as it is, since the API is not
portable anyway.

I will consider C++/CLI restricted use, only when I will want to make my
interfaces accessible in other .NET languages, while the definitions
themselves have not be in pure "C++/CLI". This is the kind of
flexibility only C++ has.



For example you can make a std::string to String * conversion easily.
C++ is better than C#!






Regards,

Ioannis Vranos

http://www23.brinkster.com/noicys
 
A

Aguilar, James

jimmy said:
I am presently working in C++ .It is flexible and efficient.But it is
not the reasons for the language to survive as hardware is running
ahead the capabilities of software(why efficiency?).Java is a cool
language and .NET too even for mobile devices and embedded
systems.Anybody can give some valid reasons so that I can understaand
C++ will survive in the coming years.

It honestly doesn't really matter that much. The dominant language will
probably be one very like C++ for a long time to come, even if C++ isn't
exactly it. Witness: Java. Java is basically C++ with a garbage collector
and pointers out the wazoo. In any case, the more you program, and the more
you practice, the better prepared you will be for any type of programming
that comes up in the future, so it is not really _that_ important what
language it is in.

The words of a student.
 
J

JKop

Aguilar, James posted:
It honestly doesn't really matter that much. The dominant language
will probably be one very like C++ for a long time to come, even if C++
isn't exactly it. Witness: Java. Java is basically C++ with a garbage
collector and pointers out the wazoo. In any case, the more you
program, and the more you practice, the better prepared you will be for
any type of programming that comes up in the future, so it is not
really _that_ important what language it is in.

The words of a student.


Why are people making such a big deal out of garbage
collection?! You can use a class to do it in C++.

-JKop
 
J

John Harrison

Why are people making such a big deal out of garbage
collection?! You can use a class to do it in C++.

First requirement of garbage collection is to know where every single
pointer is in your program. That's not easy to arrange in C++.

john
 
J

Julie

jimmy said:
I am presently working in C++ .It is flexible and efficient.But it is
not the reasons for the language to survive as hardware is running
ahead the capabilities of software(why efficiency?).Java is a cool
language and .NET too even for mobile devices and embedded
systems.Anybody can give some valid reasons so that I can understaand
C++ will survive in the coming years.

The first problem is that you can't really compare C++/C#/Java -- they all have
different intended audiences and capabilities.

C++ is a systems programming language. It can be used as an applications
programming language.

C# is a single-platform applications programming language.

Java is a multi-platform applications programming language.

Historically, C++ has been used for just about everything. Before C# and Java,
there weren't a lot of widely available alternatives, so it was used a lot for
projects that would now be better suited w/ a more applications oriented
language.

Now that there are more choices, more informed project managers will be using
the most appropriate language, which will mean that what may have been written
in C++ previously will now (more appropriately) be written in C# or Java.
However, that doesn't mean that the use of C++ for its intended purpose will
diminish. With the exception of the ill-informed pm, C++ will continue to be
used for systems-level programming projects.
 
I

Ioannis Vranos

Julie said:
The first problem is that you can't really compare C++/C#/Java -- they all have
different intended audiences and capabilities.

C++ is a systems programming language. It can be used as an applications
programming language.

C# is a single-platform applications programming language.


Actually it is standardised and there is a port in GNU/Linux along with
the CLI framework, Mono. However it lacks a standard library of its own,
so basically it can't live outside of a framework, it will always be
system dependent language.

Java is a multi-platform applications programming language.


And proprietary.


Historically, C++ has been used for just about everything. Before C# and Java,
there weren't a lot of widely available alternatives, so it was used a lot for
projects that would now be better suited w/ a more applications oriented
language.


C++ is a multiparadigm language, it supports 4 paradigms. Each paradigm
is supported *well*(1) with optimal space and time efficiencies.

(1) implies that it has all the high level constructs necessary to be
suitable for "application programming".


Always there have been other "application programming" languages before
C# and Java. Consider VB, Delphi, etc.


Now that there are more choices, more informed project managers will be using
the most appropriate language, which will mean that what may have been written
in C++ previously will now (more appropriately) be written in C# or Java.


:) Perhaps I will learn C# after some revisions (to let it mature a
bit), and I wonder what "extra" it provides to C++.

I guess it is the same situation when after C I learned Pascal. It was
piece of cake, since C abilities were a superset of Pascal so I mapped
Pascal stuff to C equivalents in my mind and learned it in 2-3 days. And
I found nothing more that C lacked, while the opposite was true.

However, that doesn't mean that the use of C++ for its intended purpose will
diminish. With the exception of the ill-informed pm, C++ will continue to be
used for systems-level programming projects.






Regards,

Ioannis Vranos


http://www23.brinkster.com/noicys
 
I

Ioannis Vranos

Ioannis Vranos wrote:

:) Perhaps I will learn C# after some revisions (to let it mature a
bit), and I wonder what "extra" it provides to C++.


And essentially I know what C# provides since I have been learning .NET
programming, and .NET provides the same API and constructs for all
languages. So C# so far supports only OO programming with single
inheritance only, and it emulates multiple inheritance with the use of
interfaces. Nothing else.

So where is it better?






Regards,

Ioannis Vranos


http://www23.brinkster.com/noicys
 
F

Fraser Ross

"Ioannis Vranos"
I guess it is the same situation when after C I learned Pascal. It was
piece of cake, since C abilities were a superset of Pascal so I mapped
Pascal stuff to C equivalents in my mind and learned it in 2-3 days. And
I found nothing more that C lacked, while the opposite was true.

Pascal has function types and the closest thing in C++ is a pointer to a
function. Also Pascal has the WITH keyword which C++ hasn't so C and C++
are not entirely a superset of Pascal.

Fraser.
 
G

Gianni Mariani

jimmy said:
I am presently working in C++ .It is flexible and efficient.But it is
not the reasons for the language to survive as hardware is running
ahead the capabilities of software(why efficiency?).Java is a cool
language and .NET too even for mobile devices and embedded
systems.Anybody can give some valid reasons so that I can understaand
C++ will survive in the coming years.

"Cool". Is that a technical term ?

Probably the buggest advancement in programmer productivity recently has
been automatic memory management in the name of garbage collectors or
smart pointers.

In C++ you can use both. You also get to use RAII not just in smart
pointers but also for locks, files etc which makes programmers even more
productive.

Templated (or generics) programming is also a huge programmer
productivity boost.

These are all things you can use today with C++. They're stable
features and can be used in critical applications. Compilers are widely
available and they're actively being developed.

The biggest drawback of C++ is the learning curve, however, if you start
putting all these features into Java, you're going to get the same
learning curve anyway.

IMHO, text based languages will be a thing of the past. The text editor
is simply a poor input tool for the complex systems we put together
today so eventually, all text based languages are toast. (IMHO that is).
Since today, we have no viable alternative, we're stuck.

G
 
I

Ioannis Vranos

Fraser said:
Pascal has function types and the closest thing in C++ is a pointer to a
function. Also Pascal has the WITH keyword which C++ hasn't so C and C++
are not entirely a superset of Pascal.


:) WITH is extremely insignificant. Can you give an example what do you
mean with "function types"?

Indeed strictly speaking C is not a superset of Pascal (since for
example you can define a function inside an other function and it has
procedures), however what I meant is that C has more abilities than
Pascal and the procedures, WITH etc stuff don't make any major
difference in terms of length of source for example.






Regards,

Ioannis Vranos


http://www23.brinkster.com/noicys
 
P

Phlip

jimmy said:
I am presently working in C++ .It is flexible and efficient.But it is
not the reasons for the language to survive as hardware is running
ahead the capabilities of software(why efficiency?).Java is a cool
language and .NET too even for mobile devices and embedded
systems.Anybody can give some valid reasons so that I can understaand
C++ will survive in the coming years.

Those languages (Java & C#) crippled themselves by trying to steal mindshare

The authors of Java said, "Hey, if we invent a language that looks kind'a
like C++, but doesn't have stray pointers or bugs in its polymorphism
system, we can get C++ programmers to think they should use it, and we will
have a guaranteed audience". And it worked.

Imitation is the sincerest form of flattery. But Java has plenty of
opportunities for stray pointing, zombie objects, broken exception
specifications, etc. A language invented to fake-out another language, not
invented to express the latest software engineering ideals, sells itself
short.

The big divide in OO languages is between static and dynamic typing. The
latter, compared to C++, works by inheriting everything from a magic base
class called "Object", which has every method that all its derivations have.
You can pass a reference to any object into any function, so long as that
function only uses methods that particular object has.

Ruby is a bigger threat to C++.
 
G

Gianni Mariani

Fraser said:
"Ioannis Vranos"



Pascal has function types and the closest thing in C++ is a pointer to a
function. Also Pascal has the WITH keyword which C++ hasn't so C and C++
are not entirely a superset of Pascal.

WITH is a nightmare. In C++ you can use references that do more or less
the same thing in a much easier way than WITH statements.

It's been discussed a number of times on comp.std.c++
http://groups.google.com/[email protected]

"with" is one of those features which seemed nice at the time but after
having had a number of problems with it, it's just not worth the hassle.

C++ references can be used to solve almost the same problem in a more
generic way.

G
 
F

Fraser Ross

"Ioannis Vranos"
:) WITH is extremely insignificant. Can you give an example what do you
mean with "function types"?

They must be similar to references but can be uninitialised and changed. An
instance of a function type can be made and assigned a real function with
the same signature and later reassigned a different function. The real
function can be called through the function type instance.

Fraser.
 
I

Ioannis Vranos

Fraser said:
They must be similar to references but can be uninitialised and changed. An
instance of a function type can be made and assigned a real function with
the same signature and later reassigned a different function. The real
function can be called through the function type instance.



Well this sounds similar to pointers to functions.






Regards,

Ioannis Vranos

http://www23.brinkster.com/noicys
 
J

JKop

Phlip posted:
"Hey, if we invent a language that looks kind'a like C++, but doesn't
have stray pointers or bugs in its polymorphism system, we can get C++
programmers to think they should use it, and we will have a guaranteed
audience". And it worked.


May aswell put stabilizers on your bike while you're at it.


Am I the only person in the universe that hasn't had problems with "stray
pointers"? I feel I must be missing something here, because it seems oh so
simple.


-JKop
 
D

David Eng

jimmy said:
I am presently working in C++ .It is flexible and efficient.But it is
not the reasons for the language to survive as hardware is running
ahead the capabilities of software(why efficiency?).Java is a cool
language and .NET too even for mobile devices and embedded
systems.Anybody can give some valid reasons so that I can understaand
C++ will survive in the coming years.

No one can predict the future. No one knows C++ or even Java will survive.
My experience tell me that mastering one programming language is not enough
in today's environment. The more languages you learn, the better programmer
you are. But you have to understand the relationship between these
languages. Here is the stack:

Java or C#
C/C++
Assembly
Machine Code

That is, if you want to be a good Java programmer, know C/C++ will help. If
you want to be a good C/C++ programmer, know Assembly will help. My
suggestion is know at least tow languages. I prefer C/C++ and Java, which
are platform and vendor independent. If you learn CORBA, it's very easy to
combine these two languages together so that you can choose the language
which can do the best job for a given project and communicate with each
other. My only suggestion is stay away from Microsoft technology, such as
C#/CLI stuff. The reason is Microsoft is never a leader but always a
follower in term of innovation. When she follows the leader to update her
technology, the technology usually doesn't have backward compatibility. For
example, with CLI (it follows J2EE), VB, COM, MFC, C++ programmers become
outdated. If you learn C#/CLI or so called C++/CLI, I am sure you will be
outdated after 5 years.

FYI: C++/CLI is the worst language you want to learn. Not only you have to
learn two sets of APIs, one from CLI and one from standard C++ library, but
also you have to know which one is suitable in which condition, which one is
better than the other in same condition, and which on is ....
 
P

Phlip

Ioannis said:
Well this sounds similar to pointers to functions.

Which are a feeb, mechanical attempt to provide "block closures".

Event-driven architectures are much more decoupled than passive ones. But
not many languages provide them, including many inexplicably popular
languages designed specifically to support event driven programming.

Here's a block closure in Ruby using the Tk library. Oval is a widget on the
screen. 'bind()' is a function that binds an event to a keystroke. When the
user clicks the first mouse button (sometimes incorrectly called the "Left
Mouse Button") on that oval, the {block} following the 'bind()' call
executes.

X = 42

oval.bind('Button-1') {
|event|
doc(event)
puts x.inspect()
}

Ruby statements between { and } (or begin and end) form an object, called a
block, which passes into any method on its left. That method can execute the
statements inside the block immediately, and can store the block as an
object, called a Proc, so something can call it later. The block links to
instances of variables seen from functions around it, such as our x, even
after such functions return. Each instance of the block links to a parallel
instance of each variable, so such variables persist until the block itself
destroys. Languages such as Perl and Smalltalk also use these "block
closures". They are more than a convenience: Variables must always have the
narrowest scope possible, and variables linked to a block, such as x, have
the narrowest conceivable scope over an indefinite lifespan.
 
P

Phlip

Am I the only person in the universe that hasn't had problems with "stray
pointers"? I feel I must be missing something here, because it seems oh so
simple.

Someday, JKop may get to maintain legacy code not written by someone as
non-stupid as JKop. Then JKop will appreciate learning the smell and the
feel of various kinds of mystery crashes. Oh, this one feels like an array
overrun. Oh, that one feels like a double delete.
 

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,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top