3

Just to ask. Would you like C++ to run in a virtual machine - Maybe like java JVM so it can be cross platform.

Comments
  • 12
    C++ is more capable than the JVM. Why would I want that in the way?
  • 1
    @Demolishun I would just like it to have the "write once, run anywhere" like java and just wishing to know how many will like that.
  • 3
    @JosiasAurel crosscompiling is your friend. But if you really want to do it this way: docker.
  • 11
    1. It would defeat the point of C++'s low level features.

    2. C++ is already cross platform as heck, because there are compilers for basically every platform apart from some embedded, specialized, and research processors.

    3. You can compile C++ to a common intermediate representation like LLVM bitcode and execute that directly via lli or compile it down to whichever platform you want using llc and then assemble it into an executable (so what you want to do already basically exists).

    4. Sure, why the heck not, go ahead.
  • 0
    @JosiasAurel Yes, that would be cool. However, I can get gcc for just about any platform these days. So it would be neat academically, but not real useful for me personally.
  • 0
    @JosiasAurel Could it be used with Minecraft in addition to java? That would be cool.
  • 0
  • 0
    @RememberMe yeah your points are right. It may disrupt some of the low features of c++ but I thought about the virtual machine to like have access to those features so the programmer just request that access and use it like any other API. Just sure that embedded systems will still be using specific code. Maybe the compiler will just compile in a virtual machine code just for cross platforming
  • 0
    @nitwhiz docker is good but really it takes alot to build container and ship......... All I want is a virtual machine which runs the same code on every platform without having to rebuild for every platform. Sure you know how java does that, I want something similar
  • 0
    @JosiasAurel and now consider the linux's namespaces. Suppose you build a cpp app using them and run in a vm. How do you port that app to windows? Afaik it does not have the concept of namespaces. How would the vm consume namespaces' api if it does not even exist?
  • 0
    @JosiasAurel Building large programs takes time and recompiling for every platform sucks. Just want to do so once so that it will take away all the strain of rebuilding for every platform
  • 0
    @netikras just try to make the virtual machine adapt. Maybe even make a version of c++ that will eliminate such strain. I think many people may like that but it's just an idea. I just wish to make that CVM (C++ Virtual Machine)
  • 0
    @JosiasAurel adapt to what? You mean to extend the operating system to enrich it's core feature set? Sounds like a separate os rather than just a vm..
  • 0
    @JosiasAurel yet another example. A cpp app which modifies windows registries. How do you imagine this happening on a Linux, aix, sunos machines? How would the adapting look like?
  • 2
    Emscriptemis a tool to compile c++ into javascript ;)

    They used it to build transport tycoon for running in the browser.

    That said, except existing software or legacy code tat you need to move I really cannot see the reason.

    One of the major uses are either low level coding, which would not work cross platform, or for high performance code, also not something you would run on top of a runtime library, it would negate much of the reason for c++.
  • 0
    @Voxera maybe I say maybe I dreamt far enough to forget that but still I think it can be a good idea. So I'll just try kind of many uses of c++ and redraw a feasibility graph
  • 0
    @Voxera still I target it mostly for software developers so they can build software in their favourite language or in c++ because it's best suited for that specific type of software. As I said, for purposes which the cross platforming will not work (like embedded systems of programmable circuits) the usual method is applied.
  • 0
    @JosiasAurel Dockerfile:

    FROM gcc

    Done.
  • 3
    Dude we already have a c++ that runs on a virtual machine.

    Its called java.
  • 0
    What the fuck
  • 0
    @yellow-dog C++ doesnt force the use of objects
  • 0
    @Demolishun what do you mean by that
  • 0
  • 0
    @Demolishun java us not c++ and yeah I just learned I must not have a class for a simple java program except from java 7+
Add Comment