Compatibility with other languages.

This is a discussion on Compatibility with other languages. within the C# Programming forums, part of the General Programming Boards category; I know that with .NET intermixing of languages is becoming a lot more common, but in this question, I'm not ...

  1. #1
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913

    Compatibility with other languages.

    I know that with .NET intermixing of languages is becoming a lot more common, but in this question, I'm not referring to that - I'm just talking about stand-alone everyday programs like a Hello World! program or something. I know the issues with C++ compiling under C compilers and vice versa, but how do the two get along with C#. I've never done any C# but I was just wandering, and I could be completely off - for all I know, C# could be based on some entirely different system, although it seems apparent that C# is C-derived.

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    The syntax is very c-like. Just like Java. However, you need a real C# compiler, unlike C/C++ where C code will compile fine as C++.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    will C and C++ compile on a C# compiler though?
    "There are three kinds of people in the world...
    Those that can count and those that can't."

  4. #4
    Unregistered
    Guest
    No son, the C# compiler will only compile C# code.

    You can get it for free at www.microsoft.com. Search for the .net framework SDK on the website and download it. Than pick up any book on C# and use notepad as your IDE, than compile your code on the command line. The C# command line compiler is called csc.exe, so just type csc /help on the command line to get a list of compiler options.

  5. #5
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    nah its ok
    ill stick to C++ for now
    "There are three kinds of people in the world...
    Those that can count and those that can't."

  6. #6
    Something Clever ginoitalo's Avatar
    Join Date
    Dec 2001
    Posts
    187
    I think what Sean meant when he posted his question was if a C# program could "use" an existing C++ program.

    I would say the answer is yes but I don't know how.

    I say yes because Visual Studio.NET is VS6 (written in C++) but all the new features in VS.NET you see are coded in C#.

    If anyone has some sample code showing mixing languages,
    post away !

  7. #7
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    but, if C++ code could compile on a C# compiler, why do they include Visual C# and Visual C++?
    "There are three kinds of people in the world...
    Those that can count and those that can't."

  8. #8
    Something Clever ginoitalo's Avatar
    Join Date
    Dec 2001
    Posts
    187
    >>but, if C++ code could compile on a C# compiler, why do they include Visual C# and Visual C++?


    -C++ cannot compile on a C# Compiler

    -VS.NET's Visual C++ is for C++ (Managed C++ for the most part)

    -VS.NET's Visual C# is for C#


    p.s. Managed C++ is ugly

  9. #9
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    you just contradicted yourself.

    >> I say yes because Visual Studio.NET is VS6 (written in C++) but all the new features in VS.NET you see are coded in C#.

    >> C++ cannot compile on a C# Compiler
    "There are three kinds of people in the world...
    Those that can count and those that can't."

  10. #10
    Something Clever ginoitalo's Avatar
    Join Date
    Dec 2001
    Posts
    187
    How ?

    all the new features in VS.NET ARE coded in C#.

    do you really think that they didn't use VS6's existing code to make VS.NET ?

    and saying C++ cannot compile on a C# Compiler is correct.

    If your wondering, when you mix languages they are interpreted separately or else there would only be 1 compiler.

  11. #11
    TK
    Guest
    The differece that some of you guys have to get into your head is that unmanaged code is different than managed code. Managed code is compiled first to an intermediate language. There is a world of difference between managed C++ and unmanaged C++. Managed C++ targets the common language runtime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why C Matters
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 136
    Last Post: 01-16-2008, 09:09 AM
  2. Strange loop
    By D@rk_force in forum C++ Programming
    Replies: 22
    Last Post: 12-18-2004, 02:40 PM
  3. Languages dying
    By Zewu in forum A Brief History of Cprogramming.com
    Replies: 31
    Last Post: 07-29-2003, 11:08 AM
  4. Programming Languages
    By DarkViper in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 12-12-2002, 02:28 PM
  5. How can an api be accessed through other languages
    By Shadow12345 in forum Windows Programming
    Replies: 6
    Last Post: 10-21-2002, 08:01 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21