Reputation
4,602
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
3 19 22
Newest
 Enthusiast
Impact
~502k people reached

  • 0 posts edited
  • 0 helpful flags
  • 129 votes cast
Apr
12
comment How to deal with misconceptions about “premature optimization is the root of all evil”?
@errantlinguist: If you presented evidence of that section of code being a significant performance problem for the application, and the application as a whole was slower than it needed to be, and they still denied the need to modify the code, then it doesn't matter. You're dealing with people who are impervious to evidence-based reasoning, and thus are unreasonable.
Apr
12
comment How to deal with misconceptions about “premature optimization is the root of all evil”?
@errantlinguist: If the program really is "slow as molasses", then clearly you ought to be able to easily detect Knuth's "that critical 3%" and therefore trump any arguments against optimizing it. And if you can't detect that... then you haven't done your homework yet and you aren't ready to optimize yet. So it's not clear where the problem is.
Apr
12
comment Why doesn't the compiler complain when I try to access a non-existent array value?
@5gon12eder: I'd be curious to see how you could do runtime bounds checking on a pointer parameter variable which may or may not point to an array. At least, not without breaking ABI compatibility, since most ABIs don't pass an integer size along with pointers. Or, as in the example I provided, where you get a pointer to part of an array. I'm sure there are compilers that can emit code to do some bounds checking. But it would never be comprehensive.
Apr
12
revised Why doesn't the compiler complain when I try to access a non-existent array value?
deleted 2 characters in body
Apr
12
answered Why doesn't the compiler complain when I try to access a non-existent array value?
Apr
4
answered How aggressively to change in-house smart pointer to unique_ptr?
Mar
25
comment Is it correct to say that a variable is an instance of a data type?
@Ixrec: Note that literals are a different kind of thing. Literals are a kind of prvalue. But you can't make literal variables, so that's a different discussion.
Mar
25
comment Is it correct to say that a variable is an instance of a data type?
@Ixrec: "If not, what are they instances of?" The type int. The C++ standard does not make a distinction between primitive types and non-primitive types when talking about what variable declarations do. So T t; declares an object of type T, no matter what type T happens to be.
Mar
25
comment Is it correct to say that a variable is an instance of a data type?
"Values of primitive types are generally not said to be instances of that type; it is reserved to objects and classes." That's not true at all. Nowhere in the standard are values of primitive types not considered objects. Nor does the definition of a variable change in any way depending on whether it is a user-defined class or a primitive type.
Mar
25
comment Is it correct to say that a variable is an instance of a data type?
PODs are objects in C++. Not all regions of memory are objects, but PODs are not just regions of memory.
Mar
22
comment Unique pointer initialisation
Actually, I'm pretty sure that C++ requires that the copy be elided. The initialization of a variable by T t = T(); is required to have a valid and accessible copy constructor, but the standard requires that no copy constructor is called.
Mar
21
awarded  Enthusiast
Mar
5
comment In C, are large 'pointer chains' bad for performance or code cleanliness?
@JavaProphet: Your example did not include "long lines of referencing". Or dereferencing. That's why people are confused.
Mar
5
answered In C, are large 'pointer chains' bad for performance or code cleanliness?
Feb
26
revised Is it a good idea to document every assumption in code, even if it goes against the standard of the language?
added 462 characters in body
Feb
26
answered Is it a good idea to document every assumption in code, even if it goes against the standard of the language?
Feb
18
comment Member vs. free-standing functions with respect to interface uniformity
@JerryCoffin: A variant of that proposal has already been accepted and passed to CWG for induction (but just f(x, y) -> x.f(y), plus pointer variations). Unified call syntax is as done a deal for C++17 as anything at this stage.
Feb
15
answered Destructing an object of a class correctly
Feb
15
awarded  Enlightened
Feb
15
awarded  Nice Answer