3

I do not understand how Java could rely on C++ code at the times of C++ hadn't a memory model ? I mean, Java had memory model all the time ! But it's written using C++ language which hadn't one until C++11 version of the language.

How could it be possible ? Please, bring some light !

Thanks!

5
  • What do you mean by memory model? Commented Apr 21, 2014 at 7:40
  • 2
    @PomfCaster the rules of the language that determine execution order, visibility etc. in a multi threaded execution of a program. Commented Apr 21, 2014 at 7:44
  • 2
    Java's memory model was considered broken by many until Java 5. Commented Apr 21, 2014 at 7:51
  • 2
    @PomfCaster stackoverflow.com/questions/6319146 Commented Apr 21, 2014 at 7:53
  • Can you please explain what specific problem would exist? Commented Jun 10, 2019 at 5:15

1 Answer 1

8

This is possible because Java VMs were written using non-portable knowledge of the memory models of the implementations of C++ that compiled them.

The introduction of a memory model into C++11 is useful since it provides a standard model, and so future C++ code does not need to rely on detailed knowledge of particular C++ implementations.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.