5 ms·
There's many reasons to criticize C++. None of them have to do with whether it's "managed" or not. Whether to use a "managed" (i.e., garbage collected and unabl
by strlen 16y ago
There's many reasons to criticize C++. None of them have to do with whether it's "managed" or not. Whether to use a "managed" (i.e., garbage collected and unable to perform unsafe memory access) language is an orthogonal issue; applicability of either approaches depends on the problem at hand. Some problems can't be solved without raw memory access, other problems can be solved but only at great performance and reliability cost, others don't benefit significantly from either approach yet others are dangerous or difficult to solve without memory management.
The real criticism of C++ is that it's an accidentally complex language (1) built by multiple warring tribes: one that wanted object orientation, the other that wanted static typing, yet another that wanted generic programming. What happened is that all of them won. Nonetheless, there is likely more than just a social reason no other language emerged for (relatively) high-level systems (2) programming (not that it hasn't been tried e.g., Modula-3 and most recently -- and promisingly -- Go). The only real alternative seems to be "C with objects" (e.g., glib or VFS layer in the Linux kernel).
That, however, still has nothing to do with what the article is about: is it me, or are the Windows C++ APIs just horribly designed? Qt, while far from perfect, is a just a lot easier to program to.
(1) It's fine for a language to be complex for a reason. Haskell is complex, yet that's because it's based on a very different paradigm which brings many advantages to the table. C is necessarily more complex than Python because it's meant to make systems programming possible.
(2) Nonetheless the domain of systems programming (which I'm going to ad-hoc define as something that requires dealing with memory addresses, the OS kernel and physical hardware) is shrinking. It's now possible (in terms of getting great performance) to write a database or a distributed lock manager in Java or a web server in Python or Ruby. So I am going to use "systems programming" here to mean operating system, driver, embedded, etc... development.
- ComputerGuru 16y ago> is it me, or are the Windows C++ APIs just horribly designed? There's your problem right there! Windows does NOT have an C++ APIs (if you put COM aside). They're all legacy plain-C APIs and they're difficult to fathom in our increasingly object-oriented world. Keeping in mind backwards compatibility and isolation of memory management (no objects or memory allocations are passed across memory boundaries due to architectural reasons in the Windows platform itself and not due to the design of the API) between libraries, the Win32 API is actually remarkably well designed. You've got C-based declarations for literally a hundred thousand functions, each with varying functionality depending on what you want to use it to accomplish. And it preserves backwards compatibility. And it has managed to keep up with the latest tech and features. Plus, half-way through, they went ahead and re-implemented each and every function in a Unicode version while keeping the old ASCII version fully available. I used to think the same. I used to look at Win32 and groan. But when I realized the extent of its complexity, the domain constraints it was under (OS design, DLL isolation, etc) the requirements (backwards compatibility, static functions for literally everything).. it all made sense. What gets me is new languages that have way worse problems without the same good reasons. Take a look at PHP and its strlen vs str_pad (why _ sometimes and sometimes no?) and its str_replace(needle, needle, haystack) vs strstr(haystack, needle)... that's uncalled for, badly designed, and with no excuse.
- alextingle 16y agoThe WinAPI is horribly designed. The choice of language has nothing to do with it. A plain C API can be a joy to work with (e.g. pthreads, or any POSIX API). There is just no excuse for the myriad of WinAPI functions that take 13 parameters in random order, most of which need to be set to 0, -1 or NULL to get it to work.
- ajuc 16y agoThe excuse is backward compatibility, and it is also why linux binaries from 3 years ago doesn't work on new linux, and win32 binaries does (or at least did before vista age). PS I prefer linux way (clean the api, no matter old binaries), but that's because I'm programmer, as a user I would love to just download old binary from net and have it work without worrying about dependencies.
- jussij 16y agoI was amazed to find that a version of the Zeus editor dating back to 1995 still runs fine on Windows 7 and that software is not even Win32. It's written in Win16. And here is the link to prove it: http://www.zeusedit.com/z300/zeus-v103.zip http://www.zeusedit.com/z300/zeus-v103.zip
- ajuc 16y agoMy last windows was xp, bu I've heard win7 was supposed to have virtual machine with winXP to run older program. If so, this is cheating :)
- ComputerGuru 16y agoNot really. You need to separately install the XP Virtual Machine software on Windows 7. He means it actually runs "out of the box." (Windows 7's XP emulation mode is nothing like the super cool Rosetta on OS X)
- angstrom 16y ago