Tuesday, July 14, 2009

Is any C++ program executed by C# ?

I want to know if C# language has ability to execute any program made by C++ language (as like as C++ had ability to execute any C program) or if C# is a language with different features and not extention to C++.

Is any C++ program executed by C# ?
That's a really good question, but I don't think so unless the compiler supports both. If I'm not mistaken, C# is somewhere between C++ and Java. It has many similarities and uses much of the code but I don't think it's fully compatible. I could be way off though.





More Info: I'm not trying to get into a p***ing contest, but the information the other guy gave is only partially correct. What he's describing is a compiler that supports all of those languages... this doesn't mean all compilers support all those languages as he's implying. That's what I was trying to say, if you have a compiler that will recognize both codes, it'll work, but I don't think a C# only compiler will compile C++.
Reply:To add to all this confusion, the answer is yes and no. It is possible to take c++ source code and c# source code and get them to communicate with eachother by converting the c++ code into a form which can run on the .NET framework using C++.NET. The c# compiler only compiles c# code, but there is a seperate C++.NET compiler which will compile the C++ code, and can compile it into a dll which the c# code would be able to reference.





The trick is that you do need to modify the C++ code to run under .NET and you need to recompile it using C++.NET, natively compiled C++ code won't work with C# code.
Reply:The answer is no.


Even C++ doesn't have an ablility to "execute" ANY C program, there is possible to write a C program that will not be compiled by C++ compiler (it's pretty easy, just name variables "class", "virtual", "public" - it's valid in C, but not in C++).





However, C# is way more different from C++. These languages are built over completely different principles and C# does not superset C++ in any way. Some words and syntax constructs are look alike, but that is only occasional similarities here and there. The most of the stuff in C# and C++ is different.
Reply:no no no no... C++ and C# and C and VB are all compiled by a compiler, the same compiler actually, SO C++ isnt compiled by C#, its compiled by a GNU compiler... witch stands for GNU NOT UNIX... lol the gnu part had me confused for a while... but its just the name :D, and C# is compiled by the GNU.. just to reiterate

garden flowers

No comments:

Post a Comment