8,400 reputation
42245
bio website google.com/…
location Berlin, Germany
age
visits member for 3 years, 10 months
seen Jul 1 at 13:23

May
22
comment Where did the notion of “one return only” come from?
@Mehrdad: I have answered to this years ago.
May
22
comment Where did the notion of “one return only” come from?
@Mehrdad: 1. Write good, easy to understand, well maintainable code. 2. Fix the bugs. 3. Test whether it's fast enough. 3a. If it is, your done. 3b. If it isn't, profile and measure to find the (few) hotspots, and sacrify readability there. Only there.
May
7
comment When to use C over C++, and C++ over C?
@Dan: What's the difference to my third bullet?
Jan
31
comment Where did the notion of “one return only” come from?
@Piovezan: "I can't see how introducing a local variable to be returned at the function's end necessarily leads to manipulating control flow through it." This is such a common case that I never thought I would need to show code doing that. Think a C algorithm, where all functions invoked return an error status. That is stored in a variable err, and if one function returns an error, all the others must not be called anymore. As for the rest: I won't even attempt to reply to that.
Mar
25
comment Should I expect my team to have more than a basic proficiency with our source control system?
@Joshua: That said, given your cow-worker's situation, I'd probably have demanded a git book long since and read enough in it to do the basic tasks for my everyday work. Let's not forget, though, that git is a monster to wrestle down.
Mar
25
comment Should I expect my team to have more than a basic proficiency with our source control system?
I have more kids than some here had girlfriends, and I do read technical books. However, I also have a big household to manage, two ex-wifes to haggle with, a garden to tend to, an ever-growing stack of non-technical books to read, and lots of other stuff, some fun to do and some not. So I either have to be intrigued by a technical book or I have to need the information it offers very badly in order to spend my precious reading time (mostly 120mins of commuting) with it, rather than with a good novel. And over the years I have learned that most devs are a lot less eager to keep up learning.
Mar
7
comment Is the C programming language still used?
"You may need to use C when you are low on resources and don't need object oriented capabilities." What if I need generic programming capabilities? Functional ones? C++ is a multi-paradigm language. It shines brightest and is most powerful when paradigms are elegantly combined. (Note: std::vector<std::shared_ptr<my_base>> does just that.)
Mar
4
comment Is the C programming language still used?
I cringe every time someone equals C++ with OO. -1 from me just for that.
Mar
4
comment Is the C programming language still used?
@JesperE: Indeed, C programmers instead boast about how C++ is so bloated and how it does things behind your back. Full circle. HAND.
Mar
4
comment Is the C programming language still used?
@JesperE: I guess I first read that article a decade ago. And you might have a point about programmers being home-blind about their beloved language — but this applies to C programmers just as well, so it's not an argument pro or contra either side.
Mar
4
comment Is the C programming language still used?
@JesperE: IMO the only time the STL abstractions are leaky is at compile-time, e.g. when you pass std::list iterators into std::sort, and all hell breaks lose. Otherwise it's a damn well-created abstraction. And if you feel you need to step through std lib code, you're likely doing something wrong. I cannot remember having needed to step through either std::printf or operator<< for built-ins. I have indeed looked at their code, though, to satisfy my curiosity, and I certainly think they are both mostly unreadable.
Mar
3
comment Is the C programming language still used?
@JesperE As it happens, I have changed jobs since I wrote that, and I am now programming for embedded devices. We're using C++, and it's remarkable what the STL and template meta-programming can do for you when you have weak hardware and hard realtime constraints as well as reliability necessities. (We're doing power plants.) Yes, you have to know whether you should use a std::vector or an std::map for a certain piece of code — but you do not have to implement it yourself, but can rely on well-tested, highly performant, and dependable library implementations offering high abstractions.
Nov
20
comment Prefer algorithms to hand-written loops?
See here for why I think this code is worse.
Nov
5
comment Is the C programming language still used?
@James: And unless you manage to explain why there is no room between portable assembler (you do know that C was created as such, don't you?) and half-interpreted languages on virtual machines, I will have to decide which of those categories to put your "argument".
Nov
5
comment Is the C programming language still used?
No, @James, the problem is that, whatever argument is presented, some C-zealot will still yell "but code-bloat!" and "it's doing stuff behind my back!" while covering his eyes and plugging his ears. And that's just the rational ones. The others do as Torvalds does, say things like "you are full of bullshit" instead of making any points, and honestly believe that this is any argument other than for them being infantile.
Nov
4
comment Is the C programming language still used?
@James: Might I kindly point you at this comment, where there's a link to a posting in which someone earnestly takes Linus' rant as if it was something intelligible, and takes it apart sentence by sentence. Write a reply to that that's at least half as intelligent as that one and post the link here. Or go back to the cave you came from, and keep cargo-culting.
Oct
30
comment How to make the switch to C++11?
@JonPurdy: I understand that it includes that. However, I dispute that a traditional for loop is better than std::for_each(). In fact, I believe it's the opposite. Anyway, this now gets my upvote. :)
Oct
28
comment How to make the switch to C++11?
At first I thought suggesting it for learning C++11 would be odd, but seeing that you are still stuck in C-With-Classes land... A decade ago I read Koenig/Moo's Accelerated C++. By the time I was actually already doing template meta-programming (I only read it for a review), but it still felt like a revelation. (I used it as a base for teaching C++ ever since.) Coming from C With Classes, the book can show you a whole new language you didn't know you had at your disposal. It's only 250 pages, and you can then quickly advance to something C++11-specific, but IMO it's a worthwhile step.
Oct
28
comment How to make the switch to C++11?
I like how you are sarcastic about him not using variadic templates anytime soon, but I think missing uniform initialization is missing something really important for everyday programming.
Oct
28
comment How to make the switch to C++11?
I would update if it wasn't for std::for_each(). When you have lambda, it's certainly better than a traditional for loop. With a range-based for loop that might not be the case, but you didn't write "range-based for loop".