Reputation
32,216
Next tag badge:
119/100 score
18/20 answers
Badges
3 54 127
Newest
 Good Answer
Impact
~1.7m people reached

Apr
29
comment What's your strongest opinion against functional programming?
A lot of the "follow the leader" mentality is (I think) more a matter of marketing (but: BCPL actually didn't require semicolons in many cases). I can see similarity between C#, Java, and Scala class hierarchies; C++...a lot less so. From a practical viewpoint, I think the syntactical similarity is more a asset than a liability in most cases (e.g., if Java hadn't looked extremely familiar, nobody would have bothered).
Apr
29
comment What's your strongest opinion against functional programming?
@cat: In any case, your "all just boring iterations of C that don't solve the real problems" just shows pretty much the same attitude: narrow-minded certainty that you know the real problems with C, and the people who designed all these are ignorant, stupid, or for whatever other reasons missed the ultimate truth to which you are privy. This despite the fact that many of them are routinely used (and can even work reasonably well) for tasks to which C would be extremely poorly suited at best.
Apr
29
comment What's your strongest opinion against functional programming?
@cat: partly true, but definitely only partly. For one thing, in the case of procedural languages the gratuitous proliferation doesn't generally result from failure to compromise, but from sheer ignorance and stupidity (e.g., PHP) or from marketing at the expense of technical mediocrity (e.g., Java). The question wasn't about the problems with procedural programming languages though, so that would have been off-topic.
Apr
12
awarded  Good Answer
Apr
10
awarded  Nice Answer
Apr
7
awarded  Citizen Patrol
Apr
7
comment How to write unit tests for network client?
If you want to badly enough, you can mock. Have your HTTP client use (for example) a Socket class, and by providing a mock Socket class, you can look at what gets sent, send mock replies, etc.
Apr
6
answered How should I write an interface that takes a list of items?
Apr
6
comment Why were variable length arrays made optional in C 2011?
@jxh: Fair enough--it certainly looks/seems like library to me, but I guess I can see a viewpoint from which it would seem like the core language. In any case, it's the name of a function, not the expressions/statements you can write in that function, which is the difference here. I think there'st waning concern over subsets though. When C89 was new, BASIC and Pascal had both fragmented badly, part due to a number of dialects of each (if memory serves, at least three standards each, all ignored in the wider market).
Apr
6
comment Why were variable length arrays made optional in C 2011?
@jxh: As originally envisioned, freestanding and hosted implementations used the same core language. The differences were restricted to the library. In the case of VLAs, there's a difference in the language itself that (at least some vendors felt) wasn't really suitable to smaller embedded systems. As far as embedding the size goes: no, it's probably never absolutely necessary, but may be the easiest way (e.g., a few bytes of storage for the size might avoid many bytes of code to compute it).
Apr
6
comment Why were variable length arrays made optional in C 2011?
@gnasher729: That's not entirely true. If you use sizeof on a VLA, the size has to be computed at run time, so you typically have either extra data to store the size, or extra code to compute it. Either way, there's at least some possibility of code and extra storage being used.
Apr
2
comment C Language - K&R 1st vs 2nd Edition?
@MarkAmery: Even today, calling it obsolete is a bit premature--there are still a fair number of processors with floating point hardware, but not 64-bit integers in hardware. On such hardware, a double will still usually be substantially faster than a long long.
Apr
2
comment Why double colon instead of dot?
The horrible ugly proliferation of Mason Wheeler's senseless attacks on C has no name, because such evil must not be dignified with a name!
Apr
2
comment C Language - K&R 1st vs 2nd Edition?
@MarkAmery: Please at least attempt to get your facts straight before posting. You're apparently referring to the addition of long long, but that didn't exist until C99. Also note that the question in this case was only which to choose between the first and second editions of the book. I'd tend to agree that if a third edition existed, it would probably be preferred to the second--but as-is, if you're going to read K&R at all, your only choices are the first edition or the second--and between them, the second is clearly preferable.
Apr
1
awarded  Nice Answer
Apr
1
comment In which process does syntax error occur? (tokenizing or parsing)
@PaulDraper: The fact that they can be combined doesn't make them the same, any more than the ability to dissolve salt in water means there's no fundamental difference between salt and water.
Mar
31
comment In which process does syntax error occur? (tokenizing or parsing)
@FZE: You could think that way, but it's misleading. Lexing is not "just a parser optimization". Rather, lexing maps a physical representation (some sequence of characters) into a logical representation (the tokens represented by those characters). This isolates the parser from minutiae like how the end of a line is represented, or whether you decide to represent a logical-and as and or && or something else. It's (mostly) separate and different from parsing. Optimization (if any) is an almost accidental side effect.
Mar
31
answered In which process does syntax error occur? (tokenizing or parsing)
Mar
29
awarded  Informed
Mar
29
answered Is there a better way to debug while avoiding getters/setters?