28,565 reputation
248111
bio website coderscentral.blogspot.com
location Colorado Springs, CO
age 50
visits member for 4 years, 3 months
seen 4 hours ago

Started programming on a Control Data mainframe in FORTRAN IV, back when that was still a new thing. Was apparently quite masochistic, because I kept programming anyway. For that matter, I still do...

Gold C++ badge #20
Gold C badge #12
Legendary badge #35


Sep
16
comment What is the history of why bytes are eight bits?
@Pacerier: Feel free. I'm not going to sign up for a site I don't care about just to correct them on a subject that doesn't matter much anyway.
Sep
15
comment What is the history of why bytes are eight bits?
@Pacerier: Unfortunate, some of the information there is just plain wrong (e.g., it says the PDP-10 was a 32-bit machine, but it was actually a 36-bit machine).
Sep
10
comment How to abide the “allocate in caller” rule when the size is computed in the callee?
This looks to me like it applies almost exclusively to C, not C++. In C++, instead of handle_init, handle_do and handle_free, you almost certainly want an object with init handled in the ctor, free handled in the dtor, and do handled in a member function--possibly but not necessarily an operator(). Allocation probably should be internal to the object, likely via a std::unique_ptr or some other smart pointer type.
Sep
10
comment How to do a clean refactoring of an If Else Code without leaving any free blocks?
@ADTC: I think you're reading more into his wording than was really intended. If you read through the comments, you'll see that his concern isn't really with the order in which the conditions are evaluated, but with ensuring that statement2 is evaluated only if condition1 is false. My last sentence does cover the other possibility, but his comments made it sound as if that wasn't really the intent.
Sep
5
comment What imperative programming languages do not support recursion?
@Panzercrisis: I'm not sure whether IBM was involved in the x86, but their current mainframes trace directly back to the IBM 360, which came on the market in 1964, so the basic design predates the x86 by a couple decades or so.
Jul
2
comment How bad is it calling println() often than concatenating strings together and calling it once?
I see you don't know what ad hominem means either. An ad hominem argument is one of the form: "this argument should not be believed because the person making the argument is evil.". I simply pointed to the fact that your argument made no sense: the subject of discussion is levels of abstraction, yet you proclaim that abstractions are irrelevant. That's a solid indication that you don't understand the subject.
Jul
2
comment How bad is it calling println() often than concatenating strings together and calling it once?
@Phoshi: Ignoring abstractions indicates that you don't understand the subject matter, since abstraction is exactly what's under discussion.
Jul
2
comment How bad is it calling println() often than concatenating strings together and calling it once?
@Phoshi: Try with resources isn't even vaguely similar to RAII. RAII allows the class to manage the resources, but try with resources requires the client code to manage the resources. The features (abstractions, more accurately) that one has and the other lacks are entirely relevant--in fact, they're exactly what makes one language higher level than another.
Jul
1
comment How bad is it calling println() often than concatenating strings together and calling it once?
@200_success: Java doing the string concatenation at compile time seems to come down to §15.18.1: "The String object is newly created (§12.5) unless the expression is a compile-time constant expression (§15.28)." This seems to allow but not require that the concatenation be done at compile time. I.e., the result must be newly created if the inputs are not compile-time constants, but no requirement is made in either direction if they are compile time constants. To require compile-time concatenation, you'd have to read its (implied) "if" as really meaning "if and only if".
Jul
1
comment How bad is it calling println() often than concatenating strings together and calling it once?
Actually, it's Java that requires explicit memory management. In C++ I write something like: MyClass c; and it allocates an instance of MyClass. In Java I have to use MyClass c = new MyClass(); to allcoate it. Better still, RAII let's me automate management of other resources as well, where Java forces me to use a try/catch/finally in a lame imitation of what C++ destructors provide much more cleanly. Your own argument leaves us with only one reasonable conclusion: Java is a lower level language handicapped by lower-level I/O facilities.
Jul
1
comment How bad is it calling println() often than concatenating strings together and calling it once?
Throughout I point to the objective basis for Java being the lower level language. Not sure what line terminators you're talking about.
Jun
13
comment Memory read/write access efficiency
If it's small enough to allocate directly on the stack, that's almost always preferred.
Jun
13
comment Memory read/write access efficiency
Correct about memory usage. Efficiency can vary. On really small microcontrollers and such, memory access may be faster than multiplication, which could make 3 a poor choice. As for a fourth option: perhaps avoid using malloc at all and allocate the data directly on the stack (but note that this often imposes a much lower restriction on size).
May
10
comment How are the skills used in typical interview questions applied in the real job?
@MainMa: That doesn't surprise me--that's why I repeated "as he's phrased it" a couple of times in my answer.
Apr
26
comment In Java, what are checked exceptions good for?
@owlstead: Thanks--I probably should have been more careful with the wording there. The point wasn't so much that you actually had to catch the exception as it was that every intermediate level of code needs to be aware of every exception that might flow through it. As for the rest: having a tool that makes it quick and easy to make a mess of your code doesn't change the fact that it's making a mess of the code.
Feb
19
comment Is there any difference learning OOP on different programming languages?
@KRyan: In case you care, there is one other prototype-based OO language that's named Self.
Dec
17
comment Any programming languages that support Generics exclusively and have no OOP support?
Ada 83 would be another to consider. To an extent, most Lisps are as well (other than those like Common Lisp, which also supports OO).
Nov
15
comment Making an algorithm more efficient
You probably want to use a quadtree.
Nov
9
comment Earliest use of Comments as Semantically Meaningful Things in a Program?
#pragma came from Ada (which left of the #, so it was just pragma).
Aug
19
comment Is an atomic action supposed to be deterministic?
@busy_wait: No, I'm treating any state upon which the code depends as input to that code, since it is.