7
votes
Accepted
In C++, how is signed integer stored?
In C++, how is signed integer stored?
The C++ specification does not prescribe any particular storage representation for signed integers on the actual hardware level. An implementation is free to ...
3
votes
Accepted
C++ Abstract classes vs selective compilation
That's good if you need just one implementation in a given binary
In particular for differences based on the target device, since one expects a given binary to be running on a particular platform.
I ...
3
votes
Accepted
If an object x is an instance of a type T, then what is a type T for a concept C?
If you have classes A and B, and B is a derived class of A, that is a noun property. B has a fundamental relationship to A which the very definition of B must explicitly claim.
Concepts don't work ...
3
votes
If an object x is an instance of a type T, then what is a type T for a concept C?
A concept is a predicate. I'd use the term satisfies, as in
A type T satisfies the concept C when...
Many concepts specify requirements on the interface of a type. Taking a phrase from languages ...
3
votes
Performance hit after non-functional refactoring
You didn't say what percentage in performance change. And whether it is for a tight benchmark or as part of an application.
You might see a function getting ten times slower - from 1 nanosecond to 10 ...
2
votes
Accepted
Use aggregation like LSP in C++
First things first: the UML diagram
The original diagram is syntactically correct (except for the <I> on the box boundary, which should be «interface» centered above Licence in plain UML).
The ...
2
votes
Use aggregation like LSP in C++
For a demo of the Liskov Substitution Principle the header for Billing would only have License. The point of the LSP is that any object that extends another doesn't break that base functionality. ...
2
votes
Performance hit after non-functional refactoring
It's certainly plausible that moving definitions to a new translation unit has meant the optimiser couldn't do as well.
You can #include whatever files you like, so you can re-create the old structure ...
1
vote
How would a SRP `class Car` look like?
There is no global answer to this, and in particular it depends on what your program is simulating. To take some highly simplified examples:
If your Car represents a Formula 1 race car, you probably ...
1
vote
is there a two-way (bidirectional) observer pattern?
The normal observer pattern can easily be used in a bidirectional way:
One approach is that the two objects are reciprocal subjects and observers, i.e. both implement the two interfaces and register ...
1
vote
Mocking clock in C++ unit test
Mocking the clock is difficult. The problem is, there are many system functions that check the time, and mocking them all may be impossible - with the result that different bits of code get ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
c++ × 2629c × 280
design × 244
object-oriented × 226
design-patterns × 180
java × 153
c++11 × 132
coding-style × 96
c# × 95
object-oriented-design × 89
data-structures × 76
algorithms × 70
programming-practices × 70
multithreading × 70
programming-languages × 68
performance × 67
qt × 64
compiler × 59
unit-testing × 58
inheritance × 56
libraries × 55
architecture × 51
python × 51
pointers × 51
memory × 50