2,087 reputation
1114
bio website
location Houston, TX
age 32
visits member for 4 years, 6 months
seen May 21 at 16:42

Apr
21
comment Big O Question about an algorithm with (n^2 + n) / 2 growth rate
"O(n!) is the same as O(1) for sufficiently low values of n" is just wrong. There has to be a better way to explain that "when n is kept sufficiently low, Big-O doesn't matter".
Mar
16
comment What is the reason of using an interface versus a generically constrained type
@NtscCobalt: It's more useful when you combine both parametric and interface generic programming. E.g. what LINQ does all the time (accepts an IEnumerable<T>, returns another IEnumerable<T> which is e.g. actually an OrderedEnumerable<T>)
Mar
16
awarded  Citizen Patrol
Mar
13
comment how to nicely use constant std::string in c++
Most certainly, but you'll need a definition somewhere, or suffer linker errors. Using a singleton would also avoid copying many strings many times.
Mar
13
comment how to nicely use constant std::string in c++
const is fine. The problem with the code in this answer is that the strings are non-static data members, so new copies are made for each class instance. There's no reason to have multiple copies of the same hardcoded string.
Mar
13
comment how to nicely use constant std::string in c++
The original question showed an approach that provides string objects, with a lot less copying.
Mar
12
comment how to nicely use constant std::string in c++
Are you aiming for maximum inefficiency? This makes a copy of nearly every string in the entire program each time one of them gets used!
Mar
12
comment how to nicely use constant std::string in c++
I have to disagree with nearly all of @CrazyEddie's comment. std::string does add overhead, namely dynamic allocation, and string copy, and a field for storing the size at runtime. The size of a std::string is calculated at runtime, the number of elements in a const char[] is a compile-time constant. The only advantage of std::string is the interface. Someone should provide a library of string manipulation functions that take character arrays as input and return RAII object (std::string or similar) of the needed size as output, thus both efficient and immune to buffer overflow.
Mar
10
comment what should be logger's position in the parameter list
Of course this has the drawback that the logger is unavailable to the constructor.
Feb
12
answered Is throwing an exception an anti-pattern here?
Feb
1
revised Would redrawing controls in c# give more performance?
added 159 characters in body
Feb
1
answered Would redrawing controls in c# give more performance?
Nov
16
awarded  Yearling
Sep
22
comment Undefined behavior, in principle
@jxh: Fault-tolerant systems are indeed quite interesting. But they aren't undefined-behavior tolerant. Copies running in lockstep which encounter undefined behavior may all make the wrong choice, and voting won't help then.
Sep
15
comment Undefined behavior, in principle
C and C++ use two different terms: undefined behavior and unspecified behavior. There's also indeterminately sequenced. And the distinction is important. It is possible, albeit difficult, to write a correct program in the presence of unspecified behavior. But no amount of careful coding can ensure correctness in the presence of undefined behavior. Undefined behavior removes the semantic meaning of your entire program. On the other hand, behavior left undefined by the language may be defined by the platform.
Sep
11
answered Workflow for obfuscated PHP code with PHP protect
Sep
11
comment Workflow for obfuscated PHP code with PHP protect
@RobertHarvey: But with a deobfuscated stack trace, even without values of variables and parameters, you have a fighting chance at finding the bug.
Sep
11
comment Workflow for obfuscated PHP code with PHP protect
This approach may not be possible for errors that are data-dependent, and either (1) privacy concerns forbid having a copy of the entire user database in the test environment or (2) privacy concerns prevent logs from identifying what data was being processed, to the degree necessary to select the same data in the test environment.
Sep
8
comment Is it correct to keep version numbers of all components always the same?
If you don't rerelease components just for a version bump, I still would assign the latest release number based on the overall system, not the prior release of the same component. For example, if after releasing 0.1.1 of Tool #2, you needed an (unrelated) update to the Android client, it would skip 0.1.1 and become 0.1.2
Aug
12
comment Has there really not been one thing in the past 20 years that provided huge software development gains?
Also the "return" side of the RoI isn't that good, because the market is already saturated.