3 ms·
Sorry, you'd need to use the MyType* x to use the `new` keyword; it's been awhile. It doesn't really deter from my point though; in order to heap-allocate somet
by tombert 7y ago
Sorry, you'd need to use the MyType* x to use the `new` keyword; it's been awhile. It doesn't really deter from my point though; in order to heap-allocate something you have to use a pointer, and you end up doing something not that dissimilar from Java.
> C++ is nothing at all like Java.
Is that supposed to be a joke? Java was marketed specifically towards C++ engineers...
- saagarjha 7y ago> in order to heap-allocate something you have to use a pointer Usually the heap allocation is hidden behind a handle.
- pjmlp 7y agoNot on the libraries I usually have to touch. I would already be happy when I am allowed to re-write some of it into C++11.
- iainmerrick 7y agoJavascript was marketed towards Java programmers, and those languages are pretty different from each other too.
- tombert 7y agoI would say that C++ is closer to Java than JavaScript is; it's fairly easy to copy-paste and edit C++ code into a Java file with, just changing a small amount of syntax and get rid of the manual memory allocations. Try copy-pasting JS into a Java file, and there are semantics there that are completely foreign; you can't simply translate it.
- iainmerrick 7y agoI agree that JS and Java are very different; that was my point. I disagree about Java and C++. If I have a C++ file that uses RAII or references, for example, it won’t translate to Java easily. And those aren’t unusual, they’re both common techniques.