c++ Programming Glossary: principle
Detecting endianness programmatically in a C++ program http://stackoverflow.com/questions/1001307/detecting-endianness-programmatically-in-a-c-program uint32_t i char c 4 bint 0x01020304 return bint.c 0 1 The principle is equivalent to the type case as suggested by others but this..
Why does C++ not let baseclasses implement a derived class' inherited interface? http://stackoverflow.com/questions/10464308/why-does-c-not-let-baseclasses-implement-a-derived-class-inherited-interface that's not necessary most of the time and a C guiding principle is you don't pay for what you don't use . share improve this..
Why not use pointers for everything in C++? http://stackoverflow.com/questions/1064325/why-not-use-pointers-for-everything-in-c here is simplified a lot in order to show the general principle. If we were to actually use this class it contains several possible..
C++ Accesses an Array out of bounds gives no error, why? http://stackoverflow.com/questions/1239938/c-accesses-an-array-out-of-bounds-gives-no-error-why rule which makes bounds checking non ideal. The C guiding principle is you don't pay for what you don't use . If your code is correct..
How to make generic computations over heterogeneous argument packs of a variadic template function? http://stackoverflow.com/questions/14261183/how-to-make-generic-computations-over-heterogeneous-argument-packs-of-a-variadic 1 args ... foo nth_value_of sizeof... args 1 args In principle static_for would allow for even more elaborate processing template..
Namespace + functions versus static methods on a class http://stackoverflow.com/questions/1434937/namespace-functions-versus-static-methods-on-a-class to member functions . I found an online reference to this principle in an article from Herb Sutter http www.gotw.ca gotw 084.htm..
std::function vs template http://stackoverflow.com/questions/14677997/stdfunction-vs-template the choice of templates is just an instance of a wider principle try to specify as many constraints as possible at compile time..
What is “cache-friendly” code? http://stackoverflow.com/questions/16699247/what-is-cache-friendly-code important aspect of cache friendly code is all about the principle of locality the goal of which is to place related data close..
Static linking vs dynamic linking http://stackoverflow.com/questions/1993390/static-linking-vs-dynamic-linking files. However this is not required a compiler can in principle compile static libraries to a digested AST form initially and..
Using C++ library in C code http://stackoverflow.com/questions/199418/using-c-library-in-c-code header files that are not included by C. Think PIMPL principle here. Using #ifndef __cplusplus #error stuff helps here to detect..
how-to initialize 'const std::vector<T>' like a c array http://stackoverflow.com/questions/231491/how-to-initialize-const-stdvectort-like-a-c-array vector T but these values will never change in my case. In principle I thought of something like namespace const std vector const..
Determine if two rectangles overlap each other? http://stackoverflow.com/questions/306316/determine-if-two-rectangles-overlap-each-other bottom below B's Top NOTE1 It is fairly obvious this same principle can be extended to any number of dimensions. NOTE2 . It should..
Inheritance or composition: Rely on “is-a” and “has-a”? http://stackoverflow.com/questions/453738/inheritance-or-composition-rely-on-is-a-and-has-a inheritence relationship violates the Liskov Substitution principle. By the way the example came from the linked article . share..
Effective C++ Item 23 Prefer non-member non-friend functions to member functions http://stackoverflow.com/questions/5989734/effective-c-item-23-prefer-non-member-non-friend-functions-to-member-functions necessary. In a well designed software you apply the DRY principle Don't Repeat Yourself because when a change is necessary it's..
Does const-correctness give the compiler more room for optimization? http://stackoverflow.com/questions/6313730/does-const-correctness-give-the-compiler-more-room-for-optimization because otherwise the Behavior would be Undefined. So in principle combining restrict with a pointer to const could enable both..
Random number generation in C++11 , how to generate , how do they work? [closed] http://stackoverflow.com/questions/7114043/random-number-generation-in-c11-how-to-generate-how-do-they-work codeguru. Wikipedia has a good summary thanks @Justin . In principle each engine should typedef a result_type which is the correct..
Throwing exceptions from constructors http://stackoverflow.com/questions/810839/throwing-exceptions-from-constructors
Why is strncpy insecure? http://stackoverflow.com/questions/869883/why-is-strncpy-insecure supplied value strncpy buffer argv 3 incorrectSize The principle here is that incorrectly casting a pointer to a C object potentially..
Which kind of pointer do I use when? http://stackoverflow.com/questions/8706192/which-kind-of-pointer-do-i-use-when management already and you want to adopt it to the RAII principle. This one was not adopted by the standard. Unique ownership..
Static vs dynamic type checking in C++ http://stackoverflow.com/questions/1347691/static-vs-dynamic-type-checking-in-c
Does using callbacks in C++ increase coupling? http://stackoverflow.com/questions/1727824/does-using-callbacks-in-c-increase-coupling Framework controls the overall flow as the Hollywood Principle states Don't call us we'll call you. that's what callback means..
C++0x memory model and speculative loads/stores http://stackoverflow.com/questions/2001913/c0x-memory-model-and-speculative-loads-stores of the C Concurrency Memory Model Sutter Prism A Principle Based Sequential Memory Model for Microsoft Native Code Platforms..
What does slicing mean in C++? http://stackoverflow.com/questions/2432683/what-does-slicing-mean-in-c of the slicing is always an object of class C. Design Principle Slicing an object with respect to a parent class C should still..
Testing a c++ class for features http://stackoverflow.com/questions/3336859/testing-a-c-class-for-features as 'd' PLUS that it violates the Liskov Substitution Principle. If a client needs to check that a class responds to pedal before..
Where should non-member operator overloads be placed? http://stackoverflow.com/questions/3623631/where-should-non-member-operator-overloads-be-placed class see also Herb Sutter's Namespaces and the Interface Principle . From the point of view of writing standards compliant and..
Why was argument dependent lookup invented? http://stackoverflow.com/questions/4276772/why-was-argument-dependent-lookup-invented this question ADL was invented to allow the Interface Principle The Interface Principle For a class X all functions including.. invented to allow the Interface Principle The Interface Principle For a class X all functions including free functions that both..
Inheritance or composition: Rely on “is-a” and “has-a”? http://stackoverflow.com/questions/453738/inheritance-or-composition-rely-on-is-a-and-has-a your is a has a heuristic with the Liskov Substitution Principle . To check whether an inheritence relationship complies with.. relationship complies with the Liskov Substitution Principle ask whether clients of a base class can operate on the sub class..
Subclass/inherit standard containers? http://stackoverflow.com/questions/6806173/subclass-inherit-standard-containers should be used when you are thinking Open Closed Principle . You should have abstract base classes and dynamic polymorphism..
Why use virtual functions? [duplicate] http://stackoverflow.com/questions/8824359/why-use-virtual-functions Shape type. The above is a good example of Open Closed Principle of the famous SOLID design principles. share improve this answer..
C++ Member Functions vs Free Functions http://stackoverflow.com/questions/967538/c-member-functions-vs-free-functions methods share improve this question The Interface Principle by Herb Sutter For a class X all functions including free functions.. For in depth discussion read Namespaces and the Interface Principle by Herb Sutter. EDIT Actually if you want to understand C go..
|