The future of c++

C

cafegee

As far as I concern, there is no reason that we should pattern the
future of c++ language on the current Java or c#. Why should we have
to so? c++ language has it's own specialty,it is a effiecent,flexible
language,Why should it be developed to a cross-platform language,like
Java?
 
P

Phlip

Ioannis said:
Yes, in CLI (.NET), CLI types map directly to the language types. CLI
types *are* structs.

Does that let you _inherit_ from 'int', _within_ the target language? I'm
not talking about some reflection trick, or stepping outside the language.
As far as I concern, there is no reason that we should pattern the
future of c++ language on the current Java or c#. Why should we have
to so? c++ language has it's own specialty,it is a effiecent,flexible
language,Why should it be developed to a cross-platform language,like
Java?

Allow me to be the first for you:

D Programming Language Compiled, garbage collected, simpler C/C++
replacement by Walter Bright (wrote first DOS C++ compiler). Maximum
similarity to C/C++, except where backward ...
www.digitalmars.com/d/


No, I haven't used it. It probably blows Ruby away, too. Maybe I'l start a
learner project tomorrow. I wonder how it tests-first.
 
I

Ioannis Vranos

Phlip said:
Does that let you _inherit_ from 'int', _within_ the target language? I'm
not talking about some reflection trick, or stepping outside the language.


temp.cpp(4) : error C3246: 'MyType' : cannot inherit from 'System::Int32' as it
has been declared as '__sealed'
temp.cpp(1) : see declaration of 'System::Int32'


The types themselves are sealed structs. However one can always do:


#using <mscorlib.dll>


__value struct MyType
{
int x;

public:
MyType(int val):x(val) {}

System::String *ToString() { return "Some other answer"; }

// .NET types have operator definitions as static member functions
static const MyType op_Assign (MyType &m, int &val)
{
m.x= val;
return m;
}
};


int main()
{
using namespace System;

int x= 4;

MyType y= x;

Console::WriteLine(x.ToString());

Console::WriteLine(y.ToString());
}


C:\c>temp
4
Some other answer

C:\c>
 
I

Ioannis Vranos

Fixed:


Ioannis said:
temp.cpp(4) : error C3246: 'MyType' : cannot inherit from
'System::Int32' as it
has been declared as '__sealed'
temp.cpp(1) : see declaration of 'System::Int32'


The types themselves are sealed structs. However one can always do:


#using <mscorlib.dll>


__value class MyType
 
P

Phlip

I have never found a reason to extend the 'int' type. But I would generally
prefer a language have a greater capacity for elegance. That lowers the cost
of the various techniques which can do more with less.
 
B

belief

I agree. It's not problem what Vranos said.
in now C++, we can give a class wraped the basic type without more efficency
than Java or C#.
Bjarne Stroustrup also give a method to prevent a class from being
inherited, though it is not easy as a keyword "final" like java and "sealed"
like C#.

Stroustrup.B says the next version of C++ Standard will strenghten the
constraint of the template argument.ie.type checking about template
argument. Maybe this is the neccesary point about C++ 's future.^_^
 
I

Ioannis Vranos

belief said:
I agree. It's not problem what Vranos said.
in now C++, we can give a class wraped the basic type without more efficency
than Java or C#.


I am not sure what you mean. C++ native code is naturally faster than managed code of Java
and .NET.


C++ managed code is more efficient than any other language of .NET including VC#. In VS
2005, C++ is the systems programming language of .NET. So C++ is the most efficient in
both worlds.



Some references:

http://msdn.microsoft.com/msdnmag/issues/05/01/COptimizations/default.aspx

http://pluralsight.com/blogs/hsutter/archive/2004/10/05/2672.aspx

http://blogs.msdn.com/branbray/archive/2003/11/07/51007.aspx

http://www.accu.org/conference/pres...Relevant_on_Modern_Environments_(keynote).pdf


And a page of mine:

http://www23.brinkster.com/noicys/cppcli.htm

Bjarne Stroustrup also give a method to prevent a class from being
inherited, though it is not easy as a keyword "final" like java and "sealed"
like C#.


In .NET managed classes, C++ has also the keyword sealed. Under .NET it is not a feature
of some language, it is a feature and requirement of .NET. And C++ being the systems
programming language of it, couldn't miss it, while C# misses some low level .NET features
that C++ provides (you may check the 3rd link of the above).
 
W

Wisdo Tang

Hi, Vranos.

Of course, what you said is right.
factly, I just want to give the expression that the Standard C++ should
never change
as the cross-platform language like Java because of enough facilities.
ie.the existance of the C# or another similar language is necessary for
rapid enterprise-developing,
but not for the C++ Standard.
that 's all ^_^

thanks for your respone and detail references.

regards.
wisdo (belief)
 
I

Ioannis Vranos

Wisdo said:
Hi, Vranos.

Of course, what you said is right.
factly, I just want to give the expression that the Standard C++ should
never change
as the cross-platform language like Java because of enough facilities.


And again, C++ and "Java" are two different things. "Java" is not a language, it is a
language coming together with a platform.

ie.the existance of the C# or another similar language is necessary for
rapid enterprise-developing,
but not for the C++ Standard.


Similarly many (most?) C# programmers confuse the .NET framework facilities with C#/CLI
itself. They think for example that the .NET facilities like Form class, TextBox,
TcpClient, etc are part of C# while they are not. I assume that many VB .NET developers
have similar confusion.

In any case returning to Java-syntax/JVM, if we were to compare C++ with it, we should
also pick a VM platform like .NET and then move to compare each. For example, C++ vs
Java-syntax (which is far more reduced than you think about what consists its syntax) and
then .NET vs JVM.
 

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

Similar Threads


Staff online

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top