Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. a C# version of c++ can be created?

a C# version of c++ can be created?

Scheduled Pinned Locked Moved The Lounge
csharpc++questionannouncement
36 Posts 16 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K killabyte

    why imagine why not just make ugly C# code http://msdn.microsoft.com/en-us/library/f58wzh21(v=vs.80).aspx[^]

    N Offline
    N Offline
    Nish Nishant
    wrote on last edited by
    #9

    That's still managed code. He wants to use C# syntax and generate native code.

    Regards, Nish


    My technology blog: voidnish.wordpress.com

    K 1 Reply Last reply
    0
    • N Nish Nishant

      Mark Nischalke wrote:

      And your point is?

      Not at your brightest today, are you? :-)

      Regards, Nish


      My technology blog: voidnish.wordpress.com

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #10

      Just seemed like a rant to me. It is the end of the day, or is it the beginning? I'm so confused. :)


      Failure is not an option; it's the default selection.

      N 1 Reply Last reply
      0
      • N Not Active

        Just seemed like a rant to me. It is the end of the day, or is it the beginning? I'm so confused. :)


        Failure is not an option; it's the default selection.

        N Offline
        N Offline
        Nish Nishant
        wrote on last edited by
        #11

        Mark Nischalke wrote:

        Just seemed like a rant to me. It is the end of the day, or is it the beginning? I'm so confused. :)

        :-) It's always the end of the day in some part of our planet.

        Regards, Nish


        My technology blog: voidnish.wordpress.com

        1 Reply Last reply
        0
        • V Vasily Tserekh

          Just think on the following imagine c++ to have the c# syntax but you can create pointers an all the c++ stuff but with the c# syntax i mean without the use of the net framework. I just dont know with MS have not thought in that option, cmon lets face it c++ syntax has around 25 years old, a lot of stuff has happened since then!!!

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #12

          Actually, that would suck. There are many nice things about the C# syntax, but then we'd suddenly lose templates (generics do not replace them), classes couldn't go on the stack (that will really hurt), there would be no private or protected inheritance, no friend functions/classes, half of the operators that are useful when working with pointers wouldn't exist, and I could go on for a while but maybe you get the point. On the other hand if you said "just imagine C# compiling to native code directly instead of going through MSIL", then yes, I would love that (just so long as we get to keep the nice compilation model - no linking please!). It would kill some parts of reflection, but I wouldn't mourn the loss.

          A J 2 Replies Last reply
          0
          • N Not Active

            And your point is?


            Failure is not an option; it's the default selection.

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #13

            Dangling from the sounds of it.

            *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

            "Mind bleach! Send me mind bleach!" - Nagy Vilmos

            CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

            1 Reply Last reply
            0
            • V Vasily Tserekh

              Just think on the following imagine c++ to have the c# syntax but you can create pointers an all the c++ stuff but with the c# syntax i mean without the use of the net framework. I just dont know with MS have not thought in that option, cmon lets face it c++ syntax has around 25 years old, a lot of stuff has happened since then!!!

              T Offline
              T Offline
              TheGreatAndPowerfulOz
              wrote on last edited by
              #14

              Take a look at the "D Language[^]". It might do what you're wanting.

              If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
              You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering” - Wernher von Braun

              1 Reply Last reply
              0
              • V Vasily Tserekh

                Just think on the following imagine c++ to have the c# syntax but you can create pointers an all the c++ stuff but with the c# syntax i mean without the use of the net framework. I just dont know with MS have not thought in that option, cmon lets face it c++ syntax has around 25 years old, a lot of stuff has happened since then!!!

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #15

                C# is just a language -- if you can write a compiler to compile to a native exe for your choice of operating system, then go ahead. In theory it shouldn't require the .net (or any other) framework, but there are some features (e.g. foreach, using) that require some underlying structure.

                D 1 Reply Last reply
                0
                • N Nish Nishant

                  Mark Nischalke wrote:

                  And your point is?

                  Not at your brightest today, are you? :-)

                  Regards, Nish


                  My technology blog: voidnish.wordpress.com

                  V Offline
                  V Offline
                  Vasily Tserekh
                  wrote on last edited by
                  #16

                  I just said that c++ syntax can be improved and code wont have to be so ugly and still doing the same stuff, take the c# enums for making an example.

                  N 1 Reply Last reply
                  0
                  • V Vasily Tserekh

                    Just think on the following imagine c++ to have the c# syntax but you can create pointers an all the c++ stuff but with the c# syntax i mean without the use of the net framework. I just dont know with MS have not thought in that option, cmon lets face it c++ syntax has around 25 years old, a lot of stuff has happened since then!!!

                    C Offline
                    C Offline
                    CPallini
                    wrote on last edited by
                    #17

                    I think things went into the opposite way.

                    Veni, vidi, vici.

                    1 Reply Last reply
                    0
                    • P PIEBALDconsult

                      C# is just a language -- if you can write a compiler to compile to a native exe for your choice of operating system, then go ahead. In theory it shouldn't require the .net (or any other) framework, but there are some features (e.g. foreach, using) that require some underlying structure.

                      D Offline
                      D Offline
                      Daniel Grunwald
                      wrote on last edited by
                      #18

                      It may not require a "framework" as extensive as the .NET framework, but C# (as any high-level language) certainly requires some form of runtime library. Even C needs a runtime library, the trick is to have the ability to statically link against only those portions used by your program. Unfortunately C# programs require bit of code - a good portion of the BCL (strings, arrays, etc.), the garbage collector, etc. Mono comes with an mkbundle tool that can create a native executable from managed code. Unfortunately the static linking option is not available for Windows.

                      P 1 Reply Last reply
                      0
                      • V Vasily Tserekh

                        Just think on the following imagine c++ to have the c# syntax but you can create pointers an all the c++ stuff but with the c# syntax i mean without the use of the net framework. I just dont know with MS have not thought in that option, cmon lets face it c++ syntax has around 25 years old, a lot of stuff has happened since then!!!

                        A Offline
                        A Offline
                        AspDotNetDev
                        wrote on last edited by
                        #19

                        Vasily Tserekh wrote:

                        c# syntax but you can create pointers

                        You can do that in C#.

                        Vasily Tserekh wrote:

                        without the use of the net framework

                        You don't need to reference any .Net libraries. Though I think it'd still require the CLR. On the other hand, the CLR compiles to native code, so if it drops those files somewhere maybe you could grab them (not sure if they'd run independently, however).

                        Thou mewling ill-breeding pignut!

                        1 Reply Last reply
                        0
                        • L Lost User

                          Actually, that would suck. There are many nice things about the C# syntax, but then we'd suddenly lose templates (generics do not replace them), classes couldn't go on the stack (that will really hurt), there would be no private or protected inheritance, no friend functions/classes, half of the operators that are useful when working with pointers wouldn't exist, and I could go on for a while but maybe you get the point. On the other hand if you said "just imagine C# compiling to native code directly instead of going through MSIL", then yes, I would love that (just so long as we get to keep the nice compilation model - no linking please!). It would kill some parts of reflection, but I wouldn't mourn the loss.

                          A Offline
                          A Offline
                          AspDotNetDev
                          wrote on last edited by
                          #20

                          harold aptroot wrote:

                          classes couldn't go on the stack

                          But structs can go on the stack.

                          harold aptroot wrote:

                          there would be no private or protected inheritance

                          Not sure what you mean here. Private members do get inherited, and protected members both get inherited and can be overridden.

                          harold aptroot wrote:

                          half of the operators that are useful when working with pointers wouldn't exist

                          I'm not sure what's missing, but AFAIK, you can use pointers and do various pointerly things to them (e.g., pointer arithmetic).

                          Thou mewling ill-breeding pignut!

                          L G 2 Replies Last reply
                          0
                          • V Vasily Tserekh

                            I just said that c++ syntax can be improved and code wont have to be so ugly and still doing the same stuff, take the c# enums for making an example.

                            N Offline
                            N Offline
                            Nish Nishant
                            wrote on last edited by
                            #21

                            Vasily Tserekh wrote:

                            I just said that c++ syntax can be improved and code wont have to be so ugly and still doing the same stuff, take the c# enums for making an example.

                            I was replying to Mark. And for the record, there are many people who think the C++ syntax is way better than Java/C# syntax!

                            Regards, Nish


                            My technology blog: voidnish.wordpress.com

                            1 Reply Last reply
                            0
                            • A AspDotNetDev

                              harold aptroot wrote:

                              classes couldn't go on the stack

                              But structs can go on the stack.

                              harold aptroot wrote:

                              there would be no private or protected inheritance

                              Not sure what you mean here. Private members do get inherited, and protected members both get inherited and can be overridden.

                              harold aptroot wrote:

                              half of the operators that are useful when working with pointers wouldn't exist

                              I'm not sure what's missing, but AFAIK, you can use pointers and do various pointerly things to them (e.g., pointer arithmetic).

                              Thou mewling ill-breeding pignut!

                              L Offline
                              L Offline
                              Lost User
                              wrote on last edited by
                              #22

                              AspDotNetDev wrote:

                              Not sure what you mean here. Private members do get inherited, and protected members both get inherited and can be overridden.

                              When you write class A : private B

                              AspDotNetDev wrote:

                              I'm not sure what's missing

                              ->* and .* so ok not half of them.. a third.

                              1 Reply Last reply
                              0
                              • A AspDotNetDev

                                harold aptroot wrote:

                                classes couldn't go on the stack

                                But structs can go on the stack.

                                harold aptroot wrote:

                                there would be no private or protected inheritance

                                Not sure what you mean here. Private members do get inherited, and protected members both get inherited and can be overridden.

                                harold aptroot wrote:

                                half of the operators that are useful when working with pointers wouldn't exist

                                I'm not sure what's missing, but AFAIK, you can use pointers and do various pointerly things to them (e.g., pointer arithmetic).

                                Thou mewling ill-breeding pignut!

                                G Offline
                                G Offline
                                Glenn Dawson
                                wrote on last edited by
                                #23

                                BTW, private members do get inherited, you just cannot access them in the derived class. See Derived Class Access to Base Class Members in http://msdn.microsoft.com/en-us/library/ms173149.aspx[^]

                                A 1 Reply Last reply
                                0
                                • G Glenn Dawson

                                  BTW, private members do get inherited, you just cannot access them in the derived class. See Derived Class Access to Base Class Members in http://msdn.microsoft.com/en-us/library/ms173149.aspx[^]

                                  A Offline
                                  A Offline
                                  AspDotNetDev
                                  wrote on last edited by
                                  #24

                                  Glenn Dawson wrote:

                                  BTW, private members do get inherited, you just cannot access them in the derived class

                                  Sure you can. Just not directly. :rolleyes:

                                  Thou mewling ill-breeding pignut!

                                  G 1 Reply Last reply
                                  0
                                  • A AspDotNetDev

                                    Glenn Dawson wrote:

                                    BTW, private members do get inherited, you just cannot access them in the derived class

                                    Sure you can. Just not directly. :rolleyes:

                                    Thou mewling ill-breeding pignut!

                                    G Offline
                                    G Offline
                                    Glenn Dawson
                                    wrote on last edited by
                                    #25

                                    Hehe, I just re-read your post. You said do. It's late. I'm going home now. :)

                                    1 Reply Last reply
                                    0
                                    • N Not Active

                                      And your point is?


                                      Failure is not an option; it's the default selection.

                                      F Offline
                                      F Offline
                                      Fernando A Gomez F
                                      wrote on last edited by
                                      #26

                                      Mark Nischalke wrote:

                                      And your point_er_ is?

                                      FTFY :)

                                      1 Reply Last reply
                                      0
                                      • N Nish Nishant

                                        That's still managed code. He wants to use C# syntax and generate native code.

                                        Regards, Nish


                                        My technology blog: voidnish.wordpress.com

                                        K Offline
                                        K Offline
                                        killabyte
                                        wrote on last edited by
                                        #27

                                        Nish Sivakumar wrote:

                                        That's still managed code.

                                        not really

                                        1 Reply Last reply
                                        0
                                        • D Daniel Grunwald

                                          It may not require a "framework" as extensive as the .NET framework, but C# (as any high-level language) certainly requires some form of runtime library. Even C needs a runtime library, the trick is to have the ability to statically link against only those portions used by your program. Unfortunately C# programs require bit of code - a good portion of the BCL (strings, arrays, etc.), the garbage collector, etc. Mono comes with an mkbundle tool that can create a native executable from managed code. Unfortunately the static linking option is not available for Windows.

                                          P Offline
                                          P Offline
                                          PIEBALDconsult
                                          wrote on last edited by
                                          #28

                                          Daniel Grunwald wrote:

                                          not require a "framework"

                                          It's more that it shouldn't require a virtual machine, but even that may be too generic a term.

                                          Daniel Grunwald wrote:

                                          Even C needs a runtime library

                                          Basically, yes, but is that technically true? Can't you compile and run a program that doesn't link to and use any libraries? Certainly you can write a program that doesn't # include anything. As a simple example:

                                          int
                                          main
                                          (
                                          int argc
                                          ,
                                          char* argv[]
                                          )
                                          {
                                          return ( argv==0?-1:argc ) ;
                                          }

                                          This works, but obviously with no IO it can't do much. Does this example use the "standard library"? Is it not possible to use a completely different library instead? D is similar, and includes garbage collection -- I don't know whether or not you can compile without the "standard library".

                                          Daniel Grunwald wrote:

                                          a good portion of the BCL (strings, arrays, etc.), the garbage collector, etc.

                                          Yes, but in theory you should be able to write a C# program without ever saying System:

                                          namespace Test
                                          {
                                          public static class C
                                          {
                                          public static int
                                          Main
                                          (
                                          string[] args
                                          )
                                          {
                                          return ( args==null?-1:args.Length ) ;
                                          }
                                          }
                                          }

                                          (Again, there's not much you can do without IO.) Such a program could be compiled against some minimal* implementation of BCL. I don't care whether or not it's statically linked (that's just implementation details :-D ), as long as it works. What I'm more concerned about is that the underlying structure (framework, virtual machine, whatever) needs to have a concept of System.IDisposable and System.IEnumerable in order to compile the language. * Just enough to support the language -- object, int, string, etc.

                                          D J 2 Replies Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups