Java to C++

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Steven T. Hatton

    #16
    Re: Java to C++

    JKop wrote:
    [color=blue]
    > Any compiled language will do.
    >
    >
    > C++ -> Assembly -> Machine Code.
    >
    > Pascal -> Assembly -> Machine Code.[/color]
    [color=blue]
    > Is that a typo? Should it be?:
    >
    > Java is in my opinion one of the shittest Language for the programmer[/color]

    No. Java has many advantages over C++ when it comes to provideing coherent
    APIs to the programmer. C++'s design is fairly ad hoc as regards the
    support of thrid party libraries. As a result there is a great deal of
    incongruence between the structure of libraries and the code that uses
    them.
    [color=blue]
    > Java is not a compiled language. Java is an interpreted language. Here's
    > how it goes:
    >
    > C++ -> Assembly -> Machine Code
    >[/color]

    Not all compilers have an assembly stage. Some go directly from the parsed
    source to machine code.
    [color=blue]
    > Java -> Crappy Java Code
    >
    > Then when you run your Java program:
    >
    > Crappy Java Code ---(Through Interpreter, time goes by)---> Assembly -->
    > Machine Code.[/color]

    You can compile Java to machine specific binaries.
    [color=blue]
    > Eventually all code becomes machine code, so you can't say that one
    > language is faster than the other,[/color]

    This really is a more complex issue than simply converting source to machine
    code.
    [color=blue]
    > except ofcourse when it comes to crappy
    > interpreted languages.[/color]

    So any language that is interpreted is "crappy"? Mathematica? Lisp? Icon?
    Bash?....????

    --
    STH
    Hatton's Law: "There is only One inviolable Law"
    KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com
    Mozilla: http://www.mozilla.org

    Comment

    • James Moughan

      #17
      Re: Java to C++

      Martin Demberger <Martin_D@gmx.d e> wrote in message news:<1cc6diqwz rucg$.h8oom0cqm ctq.dlg@40tude. net>...[color=blue]
      > Hi,
      > I'm working on an article about compiling java-sources to c++.
      > I'm interessted if someone would use this to write a program in java (and
      > the good IDE's available for java) and convert this to C++ to get the
      > advantages and speed of this language.
      >
      > mfg
      > Martin Demberger[/color]

      As mentioned, this is already effectively implemented in gcj.
      Unfortunately the resulting code frequently executes slower than on
      one of the better JVMs, e.g. the IBM JVM or Sun's 1.5 beta. (Memory
      usage is better, though.) It seems the overhead of Java has mostly to
      do with language features rather than the virtual machine.

      So, no, I would be unlikely to bother. Now if someone were to
      translate the Java *library* to C++, that might be useful...

      Comment

      • JKop

        #18
        Re: Java to C++

        Steven T. Hatton posted:
        [color=blue]
        > Not all compilers have an assembly stage. Some go directly from the
        > parsed source to machine code.[/color]

        But machine code can be converted to assembly code and vice versa.

        [color=blue]
        > You can compile Java to machine specific binaries.[/color]

        Are you saying that you can compile your Java program directly to machine
        code, ie. CPU instructions? But doesn't the interpreter have to take a look
        at your homework first give it the all-clear, and then send the intructions
        to the CPU on your behalf?

        [color=blue]
        > So any language that is interpreted is "crappy"? Mathematica? Lisp?
        > Icon? Bash?....????[/color]


        Never heard of any of them. But Yes.


        -JKop

        Comment

        • Karl Heinz Buchegger

          #19
          Re: Java to C++

          JKop wrote:[color=blue]
          >
          > Steven T. Hatton posted:
          >[color=green]
          > > Not all compilers have an assembly stage. Some go directly from the
          > > parsed source to machine code.[/color]
          >
          > But machine code can be converted to assembly code and vice versa.
          >[color=green]
          > > You can compile Java to machine specific binaries.[/color]
          >
          > Are you saying that you can compile your Java program directly to machine
          > code, ie. CPU instructions?[/color]

          Why should this not be possible?
          Sure one can do that.

          But it would be against the 'spirit' of Java, which is:
          You program on your computer and hand out the program. No
          matter what computer your customer uses, the program runs.

          With programs compiled to native code, this is no longer
          possible.

          --
          Karl Heinz Buchegger
          kbuchegg@gascad .at

          Comment

          • tom_usenet

            #20
            Re: Java to C++

            On Sat, 03 Jul 2004 09:51:01 GMT, JKop <NULL@NULL.NULL > wrote:
            [color=blue]
            >Steven T. Hatton posted:
            >[color=green]
            >> Not all compilers have an assembly stage. Some go directly from the
            >> parsed source to machine code.[/color]
            >
            >But machine code can be converted to assembly code and vice versa.
            >
            >[color=green]
            >> You can compile Java to machine specific binaries.[/color]
            >
            >Are you saying that you can compile your Java program directly to machine
            >code, ie. CPU instructions? But doesn't the interpreter have to take a look
            >at your homework first give it the all-clear, and then send the intructions
            >to the CPU on your behalf?[/color]

            There are a number of to-machine-code java compilers, such as GCJ. The
            output is machine code, not .class files.

            Tom
            --
            C++ FAQ: http://www.parashift.com/c++-faq-lite/
            C FAQ: http://www.eskimo.com/~scs/C-faq/top.html

            Comment

            • Peter van Merkerk

              #21
              Re: Java to C++

              Karl Heinz Buchegger wrote:
              [color=blue]
              > But it would be against the 'spirit' of Java, which is:
              > You program on your computer and hand out the program. No
              > matter what computer your customer uses, the program runs.
              >
              > With programs compiled to native code, this is no longer
              > possible.[/color]

              Unless the customer has an emulator that can run that code on his/her
              platform of choice.

              --
              Peter van Merkerk
              peter.van.merke rk(at)dse.nl

              Comment

              • P.J. Plauger

                #22
                Re: Java to C++

                "Karl Heinz Buchegger" <kbuchegg@gasca d.at> wrote in message
                news:40E914A3.5 7DBA695@gascad. at...
                [color=blue]
                > JKop wrote:[color=green]
                > >
                > > Steven T. Hatton posted:
                > >[color=darkred]
                > > > Not all compilers have an assembly stage. Some go directly from the
                > > > parsed source to machine code.[/color]
                > >
                > > But machine code can be converted to assembly code and vice versa.
                > >[color=darkred]
                > > > You can compile Java to machine specific binaries.[/color]
                > >
                > > Are you saying that you can compile your Java program directly to[/color][/color]
                machine[color=blue][color=green]
                > > code, ie. CPU instructions?[/color]
                >
                > Why should this not be possible?
                > Sure one can do that.
                >
                > But it would be against the 'spirit' of Java, which is:
                > You program on your computer and hand out the program. No
                > matter what computer your customer uses, the program runs.
                >
                > With programs compiled to native code, this is no longer
                > possible.[/color]

                That was also the 'spirit' of UCSD Pascal. Except that they failed
                to deal with the NUXI problem, so the P-code wasn't really portable.
                And Borland went on to make Pascal a *real* programming language by
                giving people a truly useful development environment centered on
                an extended dialect of Pascal.

                Moral: maybe Java still has a second life as a compiled language,
                once the 'spirit' of "write once, test everywhere" runs its course.

                P.J. Plauger
                Dinkumware, Ltd.



                Comment

                Working...