Jason T. Roff, author of many books including ADO : Activex Data Objects, visited my blog and left a comment in the blog entry reviewing his book.
I am quite happy as this is the first time that I am aware that one of the authors of the books that I reviewed actually read the review of his book. I have invited Bjarne Stroustrup to visit this blog when I have reported to him the bug found in the latest edition of his book 'The C++ Programming language' but he is a very busy man and I have not received any feedback whether he came here or not.
I just want to say that if you happen to be an author of one of the books that I have reviewed, your feedback is highly appreciated!
I have writen a new tutorial that presents an example on how to incorporate CFixeAlloc optimization into existing MFC software.
You can read it here and leave comments on it here.
I just published the second part of the serie on C programs refactoring in C++. Here is the introduction of this tutorial:
In the first part of the serie, I presented guidelines that needs to be followed when someone wish to use C++ from C programs. In an ideal world, the old C programs that you want to port to C++ should be rewritten completely. However in the real world, due to economical constraints, this is usually impossible and a more gradual approach must be adopted. During the transition period, to maximize the benefits of using C++ and to not end up with having a program consisting of just a bunch of C interfaces with C++ implementations, you can identify some patterns in the C program and refactor them appropriately. By having gone through the exercise myself, I am presenting the techniques that I have discovered and I will be discussing the benefits and the potential pitfalls of these refactoring patterns.
You can read the rest here.
I have written a new tutorial available on my website. Here is a small quote from the introduction that describes what it is about:
In this tutorial, I will introduce the simple guidelines and pitfalls to avoid when using C++ in C programs. The second part will continue by presenting higher level patterns to leverage the good software architecture patterns that C++ language facilities encourage into C programs.
You can read the rest here.
This is an acronym that means "substitution-failure-is-not-an-error" and it is used in the context of template functions overloading. When the compiler evaluates each overloaded template functions, it will not emit an error if by using the template parameter on one of the potential candidate function would generate an error. The compiler will just discard that function from the list of potential candidates. It is a powerful construction that allows metaprogramming as you can evaluate expressions at compile-time. Here is an example from the book C++ templates:
template<typename T> class IsClassT { private: typedef char One; typedef struct { char a[2]; } Two; template<typename C> static One test(int C::*); // Will be chosen if T is anything except a class. template<typename C> static Two test(...); public: enum { Yes = sizeof(IsClassT<T>::template test<T>(0)) == 1 }; enum { No = !Yes }; };
If T is a class, IsClassT<T>::Yes
will be true because the first test()
function will be chosen by the compiler. From the C++ templates book:
overload resolution prefers the conversion from zero to a null pointer constant over binding an argument to an ellipsis parameter (ellipsis parameters are the weakest kind of binding from an overload resolution perspective).
There is one subtle detail that is important enough to mention it. It is the usage of the template
keyword at the Yes enumeration declaration. The reason behind the need for using the keyword is similar to why you sometime need to use the keyword typename.
It is because of template specialization, the compiler has no clue what the dependent name "test" is. Without explicit indication with the keyword template
, it is interpreting "<" and ">" as "greater than" and "lower than" logical operators.
Maybe you were already using the principle without knowing its name but now next time you see SFINAE in a C++ forum, you will know what they are talking about.
I want you to find in this blog informations about C++ programming that I had a hard time to find in the first place on the web.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
<< < | Current | > >> | ||||
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |