3 ms·
By now he probably realizes that the Java version is what he was looking for all along: https://github.com/zeromq/jeromq https://github.com/zeromq/jeromq Why C
by bullen 7y ago
By now he probably realizes that the Java version is what he was looking for all along: https://github.com/zeromq/jeromq https://github.com/zeromq/jeromq
Why C/C++ coders don't even write "Hello World" in Java SE before drifting away into rewriting the ball bearing (1907) part of the wheel is beyond me.
The Throwable class is exceptional in every way, it wastes almost nothing and gives the programmer the ability to catch all problems that occur in the VM.
public static void main(String[] args) {
while(1) {
try {
// do everything, and always throw unchecked
// Exceptions unless you need the programmer to
// handle the problem
}
catch(Custom c) {
// here we can react to the exact problem the
// parent programmer devised
}
catch(Exception e1) {
// something "normal" happened that would have
// generated completely random behavior with
// machine code
}
catch(Error e2) {
// something "critical" happened that would have
// generated a segfault with machine code!!!
}
finally {
Thread.sleep(10);
}
}
}
The above code will never cause you to loose sleep. You can pretend there is a way to do this in any other programming language, but only C# would be able to and it is lackluster in so many other domains.
C will not help you with exceptions or concurrency, it will punish you into believing Rust is the solution.
C++ Exceptions are complete garbage, the only good part of C++ are std API (not implementation apparently) and Objects for structure, not for data (cache-misses).
Java does not crash and has the same performance as machine code, that is why it is the leading server language in the world.
Goodbye karma! Xo
Edit: that was fast!
Edit2: Please comment if you downvote.
- Bjartr 7y ago> Java does not crash # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007fae709d4a10, pid=18032, tid=140386298201856 # # JRE version: Java(TM) SE Runtime Environment (8.0_60-b27) (build 1.8.0_60-b27) # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.60-b23 mixed mode linux-amd64 compressed oops) # Problematic frame: # V [libjvm.so+0xa8aa10] Unsafe_SetNativeLong+0xf0 # # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # # An error report file with more information is saved as: # # /opt/production/hs_err_pid18032.log # # If you would like to submit a bug report, please visit: # http://bugreport.java.com/bugreport/crash.jsp #
- gjulianm 7y agoMain reason: C/C++ is compiled and can be faster than Java, basically because you control the memory, object lifetimes and there's no garbage collection. If C/C++ speed/low-level management is not required, I'd rather go to Python or, if want static typing, C#, than Java. Python gives easy development and broad library support, and C# has more features than Java (one being way better metaprogramming support).
- kllrnohj 7y ago> Why C/C++ coders don't even write "Hello World" in Java SE before drifting away into rewriting the ball bearing (1907) part of the wheel is beyond me. I write C++ & Java on a daily basis. I don't know why I would ever willingly choose Java for a personal project. It's not fun & it's inflexible. And the C++ side of me cringes with how inefficient & slow "simple" things are. Especially for anything that doesn't last long enough for the JIT to come along and make it not horrendous. If I want to pay for a JVM I'd at least go with Kotlin. But I'd take C# over Java if I had a choice. And I don't know why you think C++ means "rewriting the ball bearing"? There's a pretty decent standard library these days, and no shortage of libraries to add anything else. Depending on what you're doing there's a richer set of available libraries for C/C++ than there are for Java even (such as anything to do with graphics). > Java [..] has the same performance as machine code It so incredibly doesn't. Maybe when value types are added then Java can regain some ground on the performance front, but right now you're absolutely paying a price for Java. Often a price well worth paying, but still a price.
- winrid 7y agoI find Java a lot more fun if you don't use getters/setters for everything.
- StavrosK 7y agoAs a Python developer, I would only use a Java library as an absolute last resort, possibly even below implementing it myself or abandoning the softtware.