Home
Fractals
Tutorials
Books
My blog
My LinkedIn Profile

BOOKS i'm reading

Napoleon Hill Keys to Success: The 17 Principles of Personal Achievement, Napoleon Hill, ISBN: 978-0452272811
The 4-Hour Workweek: Escape 9-5, Live Anywhere, and Join the New Rich (Expanded and Updated), Timothy Ferriss, ISBN: 978-0307465351
The Fountainhead, Ayn Rand, ISBN: 0452273331
Web Hosting Canada

mailto:olivier@olivierlanglois.net

07/25/07

Permalink 10:59:46 pm, by lano1106, 361 words, 2115 views   English (CA)
Categories: C++

forward declaration of classes in a namespace and member (nested) classes

Forward declaration is a technique that has at least 2 purposes:

  • 1- Resolve circular dependency where class A refers to class B that refers to class A.
  • 2- Reduce header file dependencies when header file A contains functions that takes pointers or references to classes defined in another header file.

For purpose #2, a TU (translation unit) that includes header file A but does not use the functions using the class defined in header file B and does not access that class, does not need to include header file B. That way if header file B ever change and forward declaration is used, this TU will not be recompiled. Taking systematically all the opportunities to reduce header file dependencies will not make a big difference on a project containing just a few TUs but it can save hours of compilation on big projects. Also, from experience, it is much easier to plan ahead and think about this aspect as the project grows than trying to remove the dependencies once they become a major problem for maintenance!

The reason why forward declarations work is because the compiler does not need to know the size of a class to generate code that handles pointer or reference to that type. A pointer or a reference always have the same size no matter the type.

Now that I have convinced you of the benefits of using forward declarations in header files, once you start using them, you might stumble on minor difficulties. How to forward declare a class inside a namespace? I have checked into the C++ bible 'The C++ Programming Language' from Bjarne Stroustrup and it remains quiet on the subject.

Fortunately, the answer is simple. Since namespace are open, all you have to do is:

namespace A
{
// Forward declaration
class B;
};

For nested classes, you can do it too but at the condition that it is done inside the outer class full declaration.

class B
{
  // Forward declaration
  class C;
};

is ok but

class B;
class B::C;

is not. If this is something that you need, you either have to give up the forward declaration of B or move out class C out of B.

Permalink 10:08:21 pm, by lano1106, 112 words, 1726 views   English (CA)
Categories: C++

C++ Coding Standards: 101 Rules, Guidelines, and Best Practices

C++ Coding Standards: 101 Rules, Guidelines, and Best Practices, Herb Sutter, Andrei Alexandrescu, ISBN: 0321113586

I had high expectations about the fruit of the association of 2 authors that I appreciate but the result did not meet these expectations. Basically this book provides 101 rules or guidelines that you can get for free by looking at the table of content. Each of these rules is then followed by a very short explanation (1 or 2 pages usually). In my opinion, most of them are common wisdom that you can get from other sources. This is it. That is all you will get from this book. For that reason, I recommend to skip this one except if a convenient and compact collection of common knowledge is something that you are looking for.

07/19/07

Permalink 04:02:48 pm, by lano1106, 95 words, 3793 views   English (CA)
Categories: Windows programming, Windows programming

Microsoft Outlook Programming, Jumpstart for Administrators, Developers, and Power Users

Microsoft Outlook Programming, Jumpstart for Administrators, Developers, and Power Users, Sue Mosher, ISBN: 1555582869

It is not perfect. One complain is that the first part is too easy and is aimed for total beginners and then there is the second part where a lot of material is presented too fast. I wished that the book spent less time with very basic (pun intended) VBA stuff but takes more time to make the transition to more advanced topics smoother.

Other than that, the book contains a lot of code that can easily be reused such as in my C++ tutorial that shows how to automate Outlook from a C++ program.

Permalink 03:54:05 pm, by lano1106, 167 words, 2698 views   English (CA)
Categories: Windows programming

Programming Microsoft Outlook and Microsoft Exchange 2003, Third Edition

Programming Microsoft Outlook and Microsoft Exchange 2003, Third Edition, Thomas Rizzo, ISBN: 0735614644

I have been disappointed by this book. I wanted it mostly to learn how to program Outlook. When I started reading it, I have realized that only a small portion of it was dedicated to Outlook.

Perhaps that I am harsh against the book value because I am not part of the intended readers but I guess that even readers interested to programming Exchange would not find much value of this book. I am saying so because the book is huge close to a thousand pages but it sounds like a cut and paste of the Exchange programmer user manual. When I purchase a book like this one, I expect it to be a complement to the product documentation, to give a better insight of how and why a given software works like it does. This book does not deliver up to these expectations.

The best Outlook programming book that I have found is: Microsoft Outlook Programming, Jumpstart for Administrators, Developers, and Power Users. Skip this one.

07/17/07

Permalink 09:48:43 pm, by lano1106, 80 words, 2043 views   English (CA)
Categories: C++

C++ Strategies and Tactics

C++ Strategies and Tactics, Robert B. Murray, ISBN: 0201563827

You have to know that its target audience is beginner C++ programmers. I am somehow experienced with C++ programming and by looking at the excellent reviews this book got, I had high expectations when I purchased it. I have been disappointed to only have found maybe 2 small advices that I did not know. Reading over 250 pages for a so small reward has been disappointing. If you consider yourself good in C++, my advice is that you should skip this one.

<< Previous Page :: Next Page >>

Olivier Langlois's blog

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.

< Previous | Next >

December 2024
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
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 31        

Search

Custom Search

Misc

XML Feeds

What is RSS?

Who's Online?

  • Guest Users: 4

powered by
b2evolution