|
|
|
|
|
by kjeetgill
2924 days ago
|
|
> Languages do not need a 1 to 1 relationship between the storage medium of a value and the interface it exposes to a programmer. ... I suspect the reason Java did it was to not surprise C++ programmers. Solely dictated by marketing, not by technical reasons. The situation is almost the opposite of what you described it. If anything one of the major design points was to solve the surprises inherent to C/C++. Take integers for example. In java they're defined to be 2s compliment; the processor architecture doesn't matter. C/C++ left the spec open to let the language be 1 to 1 with the medium, Java did not. You can see the proposals to close this headache:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p090...
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2218.htm This is similar to all the issues with how threads interact with memory. Java lend the way in making the memory model a part of the language specification rather than allow it to be implementation (and architecture) defined. http://www.theregister.co.uk/2011/06/11/herb_sutter_next_c_p... |
|
Sure, but you're speaking past each other.
* Java was designed to be more predictable and have fewer dark corners than C++ (no undefined behaviour, precisely defined primitives and generally far less platform-specific behaviour, etc)
* Java was designed to feel familiar to C++ developers in order to aid adoption (specifically its syntax)
These aren't in contradiction.