Btw, are you guys using C++ as your main language at work?
The only course I've actually used C++ in is Computer graphics. Otherwise it's mainly C. High performance courses, real time systems, operating systems, all C courses.
not to mention many necessary costs of C having inferior type genericity in containers- what are you gonna do, malloc a separate region of memory for every value? C++ you can allocate them in-place because the type is known at compile-time
Are there any GCC-compatible suites for Windows that generate standalone executables without external dependencies?
Here are a few that do not fit the bill, ordered by undesirability, least to most:
MinGW (MSVCRT.DLL)
Cygwin (Cygwin runtime DLLs)
DJGPP (NTVDM.EXE; not present on x64 platforms)...
@DeadMG Depends... if you share immutable objects, the Java approach can actually be faster. For example, string assignment is only a couple of machine instruction in the JVM, because all you do is assign a reference.
@DeadMG I strongly believe that good garbage collection is faster than reference counting, but of course it's less predictable, and in most areas where C++ is dominant, predictability is very important.
If the user could check reference counts and if user could reallocate the buffer then it would not be problem. But then other things would be problematic. You don't want user code to have that kind of access, lest you get into C++-like problems.
@FredOverflow right, that's what i remember. utterly silly. a trap for novices (and with Java there are a lot of effectively novices using the language). it's not that there is no opportunity. it's that it's not USED.
Yes, Strings are a minefield for beginners. How often have I seen programmers compare strings via a == b... sometimes it works, sometimes it doesn't. Usually it works during testing and fails in the field :)
@AlfPSteinbach Okay, but you can't seriously complain about the lack of an optimization that would require reference counting when in practice no JVM does reference counting.
@FredOverflow Why can't I complain about it? It's utterly silly. It forces O(n^2) performance for a common task. And I'm not buying the assertion that "no JVM does reference counting".
@AlfPSteinbach No, it does not if you know what you're doing. If you want to build up a string in a loop, use a StringBuilder, not a String. Every effective Java programmer knows that.
I could also complain that strings in C++ suck because strlen is O(n). But I would look very silly, because every effective C++ programmer knows that std::string has a length method that is O(1), and you generally shouldn't use char pointers in C++.
@AlfPSteinbach In Java, using StringBuilder is the natural way of building strings. It may not seem natural to you, but it is.
If you enjoy computer and a bunch of animal gravatars, then fuck people who say it's a bad thing and you absolutely need to do something else because some unwritten social rules.