C++ implementation of core Java API

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Krazee Brenda

    #16
    Re: C++ implementation of core Java API

    On Sat, 03 Nov 2007 10:21:04 -0400, Lew wrote:
    Some years back I worked on a multi-threaded C++ app. I wrote C++
    versions of
    Java's Thread and Runnable classes for it, based on a freely-available
    pthreads library.
    >
    It turned out that it was tricky to get the semantics to match, in part
    because a C++ reference (type&) is not the same as a Java reference.
    Also
    tricky was to get Thread to be startable on its own or with a Runnable
    argument.


    McCoyHatfieldwa re

    Comment

    • Lew

      #17
      Re: C++ implementation of core Java API

      Krazee Brenda wrote:
      McCoyHatfieldwa re
      What are you on about?

      --
      Lew

      Comment

      • Krazee Brenda

        #18
        Re: C++ implementation of core Java API

        On Sat, 03 Nov 2007 22:30:20 -0400, Lew wrote:
        Krazee Brenda wrote:
        McCoyHatfieldwa re
        >
        What are you on about?
        >
        --
        Lew
        Ganjaware

        Comment

        • Lew

          #19
          Re: C++ implementation of core Java API

          Krazee Brenda wrote:
          On Sat, 03 Nov 2007 22:30:20 -0400, Lew wrote:
          >
          >Krazee Brenda wrote:
          >>McCoyHatfield ware
          >What are you on about?
          >>
          >--
          >Lew
          >
          Ganjaware
          Plonk.

          --
          Lew

          Comment

          • Roland Pibinger

            #20
            Re: C++ implementation of core Java API

            On Sat, 03 Nov 2007 10:21:04 -0400, Lew <lew@lewscanon. comwrote:
            >Some years back I worked on a multi-threaded C++ app. I wrote C++ versions of
            >Java's Thread and Runnable classes for it, based on a freely-available
            >pthreads library.
            >It turned out that it was tricky to get the semantics to match, in part
            >because a C++ reference (type&) is not the same as a Java reference.
            A Java reference is largely the same as a C/C++ pointer whereas C++
            references are 'real' references.
            >There can be a distinct value to having Java-like libraries in C++.
            I agree with that. There isn't much activity in this regard any more,
            though (and in C++ in general), see e.g.



            --
            Roland Pibinger
            "The best software is simple, elegant, and full of drama" - Grady Booch

            Comment

            • Lew

              #21
              Re: C++ implementation of core Java API

              Roland Pibinger wrote:
              A Java reference is largely the same as a C/C++ pointer whereas C++
              references are 'real' references.
              Nice pat description, but not accurate in detail. There are significant
              differences in the semantics of Java references compared to C++ pointers or to
              C++ references. That's the lesson I took away from implementing Java's Thread
              and Runnable semantics in C++, and from other experience. In fact, thinking
              of Java references as "the same", largely or otherwise, as either of the
              others will lead to trouble in the code.

              --
              Lew

              Comment

              • Peter Seiler

                #22
                Re: C++ implementation of core Java API

                Krazee Brenda - 04.11.2007 08:19 :
                On Sat, 03 Nov 2007 22:30:20 -0400, Lew wrote:
                >
                >Krazee Brenda wrote:
                >>McCoyHatfield ware
                >What are you on about?
                >>
                >--
                >Lew
                >
                Ganjaware
                KB, your endless "...ware"-contributions are very
                readworthy, impressive and remarkable. So your monthly upper
                statistic-ranking of your (re)postings is not wondering.

                BTW: And please do not quote the right delimited (-- ) sig again. THX.

                --

                by(e) PS

                spam will be killfiled

                Comment

                • James Kanze

                  #23
                  Re: C++ implementation of core Java API

                  On Nov 4, 2:57 pm, Lew <l...@lewscanon .comwrote:
                  Roland Pibinger wrote:
                  A Java reference is largely the same as a C/C++ pointer
                  whereas C++ references are 'real' references.
                  Nice pat description, but not accurate in detail. There are
                  significant differences in the semantics of Java references
                  compared to C++ pointers or to C++ references.
                  Such as? C++ pointers do have additional features: they are
                  first class objects, for example and they support pointer
                  arithmetic. But since we're talking about emulating Java in
                  C++, and not the reverse, you can just ignore the added
                  features.
                  That's the lesson I took away from implementing Java's Thread
                  and Runnable semantics in C++, and from other experience. In
                  fact, thinking of Java references as "the same", largely or
                  otherwise, as either of the others will lead to trouble in the
                  code.
                  Trying to treat pointers as first class objects in Java will
                  lead to problems in Java, yes. If you're considering mapping in
                  the two directions, then you do have very distinctive concepts.
                  But if you're looking for the functionality of Java references
                  in C++, pointers have everything that is needed. (Of course,
                  you'll probably want to install garbage collection. But you'll
                  probably want to do that anyway.)

                  --
                  James Kanze (GABI Software) email:james.kan ze@gmail.com
                  Conseils en informatique orientée objet/
                  Beratung in objektorientier ter Datenverarbeitu ng
                  9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

                  Comment

                  • James Kanze

                    #24
                    Re: C++ implementation of core Java API

                    On Nov 3, 3:21 pm, Lew <l...@lewscanon .comwrote:
                    James Kanze wrote:
                    garbage collection.) What you want to do is to "adapt" the Java
                    API to C++, taking what's good in it, and adapting it to the C++
                    idiom.
                    Roland Pibinger wrote:
                    That's the point. Adapt the Java API to C++ idioms. You can do the
                    same in C++ with pointers what you can do with references in Java. As
                    long as you don't try to copy the container the differences are minor.
                    Of course, in C++ you always have to take ownership into
                    consideration.
                    Some years back I worked on a multi-threaded C++ app. I wrote
                    C++ versions of Java's Thread and Runnable classes for it,
                    based on a freely-available pthreads library.
                    It turned out that it was tricky to get the semantics to
                    match, in part because a C++ reference (type&) is not the same
                    as a Java reference.
                    That's because Java's references are really what C++ calls
                    pointers. Most earlier C++ threading libraries had pretty much
                    the same interface as the Java one.
                    Also tricky was to get Thread to be startable on its own or
                    with a Runnable argument.
                    What was the problem? It always seems pretty trivial to me.

                    The big problem in C++ without garbage collection is managing
                    the lifetime of the thread object of a detached thread. Mainly
                    because the lifetime is largely irrelevant except for memory
                    management issues. But there are solutions which work there as
                    well, and for the most part, if you want to support clean
                    shutdown, you'll need to use them anyway.

                    --
                    James Kanze (GABI Software) email:james.kan ze@gmail.com
                    Conseils en informatique orientée objet/
                    Beratung in objektorientier ter Datenverarbeitu ng
                    9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

                    Comment

                    • hawkingliu@gmail.com

                      #25
                      Re: C++ implementation of core Java API

                      That's what I am finding now!
                      Thank you very much, and I think it will be very useful.

                      On Nov 2, 3:53 am, Craig <netburg...@REM OVEgmail.comwro te:
                      Generic Usenet Account wrote:
                      Apologies if someone finds this OT
                      >
                      I am looking for an open-source C++ implementation of Java API ----
                      something that does not require a Java run-time environment ...
                      >
                      Zhang;
                      >
                      Sourceforge.net has a number of C++ implementations . Try the site's
                      "advanced search."
                      >
                      hth,
                      -Craig
                      >
                      A couple of hits that may interest you ...
                      >
                      <https://sourceforge.net/projects/j2k/>
                      "A completely portable C++ library, to provide a standard set of classes
                      similar to Java Common API. It's highly efficient and it follows the
                      Embedded C++ Standard. It's FREE (LGPL licensed)."
                      >
                      <https://sourceforge.net/projects/stemkit/>
                      "A set of C++ libraries and build tools that provide core classes to
                      build a project upon. From exceptions and basic types (String, Integer,
                      Float, etc.) to collections and tracers. Where possible, Java API is
                      followed. Implementation is based on STL."

                      Comment

                      • Roedy Green

                        #26
                        Re: C++ implementation of core Java API

                        On Fri, 02 Nov 2007 19:18:01 GMT, Mark Space
                        <markspace@sbc. global.netwrote , quoted or indirectly quoted someone
                        who said :
                        >
                        >Definitely a good thing, since both projects look like abandon-ware, and
                        >are very incomplete. Too bad, even a partial implementation could have
                        >been useful.
                        The older you get the more wary you are of relying on any tool that
                        does not have multiple sources.
                        --
                        Roedy Green Canadian Mind Products
                        The Java Glossary

                        Comment

                        • apm35@student.open.ac.uk

                          #27
                          Re: C++ implementation of core Java API

                          On 1 Nov, 19:53, Craig <netburg...@REM OVEgmail.comwro te:
                          I am looking for an open-source C++ implementation of Java API ----
                          something that does not require a Java run-time environment ...
                          Sourceforge.net has a number of C++ implementations . Try the site's
                          "advanced search."
                          >
                          hth,
                          -Craig
                          <https://sourceforge.net/projects/stemkit/>
                          "A set of C++ libraries and build tools that provide core classes to
                          build a project upon. From exceptions and basic types (String, Integer,
                          Float, etc.) to collections and tracers. Where possible, Java API is
                          followed. Implementation is based on STL."
                          This one is pre-alpha. There is no web site and no released files. :-(

                          -Andrew Marlow

                          Comment

                          • Craig

                            #28
                            Re: C++ implementation of core Java API

                            apm35@student.o pen.ac.uk wrote:
                            On 1 Nov, 19:53, Craig <netburg...@REM OVEgmail.comwro te:
                            >>I am looking for an open-source C++ implementation of Java API ----
                            >>something that does not require a Java run-time environment ...
                            >
                            >Sourceforge.ne t has a number of C++ implementations . Try the site's
                            >"advanced search."
                            >>
                            >hth,
                            >-Craig
                            >
                            ><https://sourceforge.net/projects/stemkit/>
                            >"A set of C++ libraries and build tools that provide core classes to
                            >build a project upon. From exceptions and basic types (String, Integer,
                            >Float, etc.) to collections and tracers. Where possible, Java API is
                            >followed. Implementation is based on STL."
                            >
                            This one is pre-alpha. There is no web site and no released files. :-(
                            >
                            -Andrew Marlow
                            >
                            Yea;

                            Sorry Andrew. Looks like a wash. If you find anything let us know though.

                            thx,
                            -Craig

                            Comment

                            Working...