1,011 reputation
710
bio website
location United Kingdom
age
visits member for 3 years, 6 months
seen Dec 4 '13 at 21:41

I am a programmer. My principal language is C++. I've also done commercial work in Java, C, Perl, Python, Javascript and APL. I've also been known to dabble in python, lisp, Haskell, assembler (ARM, x86, amd64) and probably a few other languages that haven't left as big a mark.

I'm a member of the ACCU, and I spoke at accu2012 in April.


Aug
5
comment Why was the percent sign (%) chosen as the format specifier for the printf family of functions?
I am curious. Certainly, it would be possible to use {u} instead of %u but would it have any significant advantage? It seems like a largely arbitrary choice.
Aug
20
comment How do you track your progress in a project?
+1: Your observations on "Percent Complete" are >90% correct.
Aug
1
comment If a variable has getter and setter, should it be public?
@GlennNelson: What was your getter called? getFrame? getDialog? That mismatch between name and type matters a lot more - being part of the interface - than the actual name of the private variable. The fact that you were able to change the type of the object without affecting the public interface implies that the type change was minor enough not to affect clients, but doesn't that imply that even if it was a public variable that the corresponding type change also wouldn't have affected clients? I don't see how your argument shows concrete benefits to getters and setters.
Aug
1
comment If a variable has getter and setter, should it be public?
Personally, I think this is a bit of a bogus argument. If you change the meaning of a variable but the variable has a getter and setter, then it doesn't matter what it is called. It's not a visible part of the interface. You are much more likely to want to change the name of the getters and setters themselves to indicate to clients the change or clarification of the meaning of the encapsulated variable. In this latter case, you are in no better position that with a public variable. This is quite aside from the argument that a variable with getters and setters is more exposed than encapsulated.
May
17
comment How do people know the C++ Standard so well?
@Xeo: Actually, I think for quite large values. Nobody ever thinks about, let alone remarks on, the places where it gets it right. It's the less good parts that generate all the discussions.
May
17
comment How do people know the C++ Standard so well?
@q0987: Yes, standardese isn't designed to be an easy read, it's supposed to be enable a definitive unambiguous interpretation (in some cases it even succeeds!) so that it can be used as the basis of a contract between implementers and users of the language. This is why it is terse and uses defined terms for their exact meaning rather than adopting the more accessible but less precise language you might find in a text book.
Jan
27
comment What is a “side effect?”
@SLott: The definition in this answer (i.e. the first paragraph) includes the clause: "outside the intended usage". I think that my comment was fair.
Jan
26
comment What is a “side effect?”
@ChaosPandion: Personally, I disagree. The original example was much simpler and clearer.
Jan
26
comment What is a “side effect?”
I think that @KristopherJohnson has the clearest definition. Anything that alters that state of the program or its environment or produces a real world effect such as generating output.
Jan
26
comment What is a “side effect?”
The fact that the expression x++ modifies the variable x is commonly considered to be a side effect. That value of the expression is the pre-increment value of x; this is the non-side effect part of the expression.
Jan
26
comment What is a “side effect?”
I don't think that this is a good universal definition. Many programmers intentionally use constructs specifically for their side effect.
Jan
16
comment The Singleton Pattern
You can still have lazy initialization with a "global" object using an accessor. Many people mistake "I only want one" with "only one should ever be allowed". There's no need to harm your not-a-singleton class' testability if you don't need to.
Dec
13
comment What is the best C++ interview question?
@Gary Rowe: It depends on the role, doesn't it? If the opportunity is joining a team as a journeyman developer and they already have a "guru" then it may indicate a difficult time ahead; if the opportunity is to join and technically lead a team who have lost / need a new guru then perhaps it's a good thing.
Dec
13
comment What is the best C++ interview question?
This is a really good interview question because it tells the candidate whether it's worth coming back for another interview ;-) . If the interview really thinks that the code does result in an infinite loop (and the interviewer is supposed to be technically competent) then the candidate can safely give the "opportunity" a miss.
Aug
24
comment Is it ok if I don't know C but I am good with C++?
ECMA/ECMAScript?