Reputation
1,222
Top tag
Next privilege 2,000 Rep.
Edit questions and answers
Badges
9 12
Newest
 Yearling
Impact
~36k people reached

  • 0 posts edited
  • 5 helpful flags
  • 1,404 votes cast
Apr
18
comment How to open 2 Visual Studio instances, with same Git projects and different branches
Buy a second computer.
Mar
8
comment Accessing members of a set by one of their properties
Suggestion: use a std::deque<> as backing storage instead of a vector. References to elements in a deque are stable as long as insertions and deletions happen at either end only, so push_back() is safe. Therefore you don't need the if-test and else-branch.
Feb
27
comment Is it a good idea to document every assumption in code, even if it goes against the standard of the language?
@Jules Anyone not aware of that references cannot and shouldn't be nullptr, should be educated and should not be writing style guides. Converting a nullptr to a reference is UB according to the standard, and therefore is usually considered a bug.
Feb
26
comment Is it a good idea to document every assumption in code, even if it goes against the standard of the language?
The traditional way is to use a reference: void doSomething(MyType& arg). This clearly documents assumptions made.
Jan
10
awarded  Yearling
Oct
1
comment How to effectively cooperate in a team having mixed background/mindset regarding OOP?
"I believe [..] a reusable, layered OOP C++ product can get within 10% of the performance of a C-only monolithic product, [..]." While that might be good enough for most fields, "within 10%" is not good enough in high-performance finance: Fastest takes all. As a result, a single virtual call at a top-level is okay, a virtual call inside an inner loop most likely is not. Rather spend seconds setting up data-structures during start-up than one millisecond when responding to an event. Duplication of data is encouraged if it prevents a cache-miss. It really is a different way of thinking.
Oct
1
comment Should I stop using the term C/C++?
@munificent An example of a program that can be compiled in three languages - C, /bin/sh, and f77 - is the applin.c entry to the IOCCC 1986. According to your definition, the tag C/Fortran/sh makes sense now?! ioccc.org/years-spoiler.html#1986 .
Jul
22
revised Is cyclomatic complexity density a good software quality metric?
added 42 characters in body
Jul
22
comment Is cyclomatic complexity density a good software quality metric?
Reworded my answer, made the 'no' explicit, and added a reference.
Jul
22
revised Is cyclomatic complexity density a good software quality metric?
added 645 characters in body
Jul
22
revised Is cyclomatic complexity density a good software quality metric?
added 645 characters in body
Jul
22
comment Cyclomatic complexity for 2 IFs - why not just FF or TT?
"Consider a bug that requires that f1() be called before f3()." TF will not expose that bug as f3() is never called. Only FT will expose this bug.
Jul
22
comment Is cyclomatic complexity density a good software quality metric?
@GlenH7 Yes, the suggested metrics are weak - that's exactly the point of my answer! If you know any better ones, let us know in an answer.
Jul
22
comment Is cyclomatic complexity density a good software quality metric?
@gnat The answer is stronger than the question: The question asks whether a particular metric is a good one; The answer states that no metrics are good (which includes the mentioned one).
Jul
21
answered Is cyclomatic complexity density a good software quality metric?
Apr
3
awarded  Pundit
Mar
19
comment Optional Member Data
The advantages of this hasFavoriteColor() is that it allows the getFavoriteColor() to return a reference instead of a pointer - by adding a precondition that the caller is responsible to check hasFavoriteColor() before calling getFavoriteColor() - while backing storage isn't duplicated. (of course, a decent implementation of getFavoriteColor() will include an assert to check this precondition).
Mar
19
comment Optional Member Data
There is a difference between 'empty' and 'not present'. Second, if it's a more complicated class, there might be no 'empty' representation.
Mar
19
comment Optional Member Data
Small point: "You may setFavoriteColor( "Blue" ) then be surprised when your XML output doesn't show Blue because you forgot to setHasFavoriteColor( true )." Solution: add a mHasFavoriteColor = true; in the setFavoriteColor() function. The advantage of setters over direct member access is that functions can maintain class invariants.
Feb
20
comment Typedefs to convey relations between classes
While I agree with your approach and the answers, I would suggest to use just Index. In practice - as demonstrated by your code - you'll have to prefix it with the class name anyway: ModelNode::Index, AABB::Index ...