Two Exceptional Conversations On C++

This post has already been published on code::gallery blog which now has been merged into this blog.

I had come across two exceptional conversations on C++ between two visionaries – Bill Venners and Bjarne Stroustrup. They are dated 2003, but are very much valid even today.

Titled as The C++ Style Sweet Spot and Modern C++ Style, the discussions answer some principle questions about moving from C to C++, using inhertiance the right way, using abstract classes for interface and considering the invariant for designing simple classes. If you haven’t read them yet, jump right ahead and consume them, they provide lot of food for thought and can act as design guidelines.

Unique thing about reading the discussions was that Stroustrup has not given just point answers, but has explained the reasons behind the thoughts. I am sure such reading can lead to best practices.

Technorati tags: , ,

Copyright Abhijit Nadgouda.


C/C++ Cross Platform Libraries

This post has already been published on code::gallery blog which now has been merged into this blog.

Developing cross-platform C/C++ code is not difficult, but definitely challenging and has to be disciplined. Usually, a separate interface is designed so that the platform-specific code is encapsulated. The challenges are presented on multiple fronts – every platform (OS and/or CPU architecture) has its own API for system operations, its own Endianness, implementation of pointers and more.

Today, developers have access to a plethora of cross-platform abstraction libraries. What this means is that the developers don’t have to worry about differences in the platforms and focus on their applications. The differences are abstracted into the libraries/toolkits/frameworks. Shlomi Fish has a nice extensive list including the popular Standard Template Library (STL).

Out of these, I have worked with Posix Threads for Win32, Boost and Mozilla XUL.

In addition to this Mozilla has a Cross Platform Component Object Model (XPCOM), which is the underlying base for every Mozilla application. I have also used Xerces C++ Parser. In addition to this, Ch language environment, an embeddable interpreter for cross-platform C/C++ scripting, is available for developing XML-based applications using C/C++..

Andrei Alexandrescu has developed a cross-platform library, called Loki (through his book Modern C++ Design), for illustrating benefits of policy-based programming. It employs template metaprogramming to the fullest.

Then there are Blitz++ and Matrix Template Library (MTL) (via O’Reilly Network).

As mentioned earlier, the code development should be disciplined to ensure portability. Mozilla has a C++ portability guide for making code portable.

I am sure all the libraries are not included here, if you know any that are not mentioned here, feel free to add them in the comments. I will update the post accordingly.

Technorati tags: , , , , ,

Copyright Abhijit Nadgouda.

C++ Techniques FAQ

This post has already been published on code::gallery blog which now has been merged into this blog.

Bjarne Stroustrup answers some of the frequently asked questions regarding C++ style and techniques. However, this is just an FAQ and should not be considered as replacements for books.

It is a good revelation on some techniques, e.g., Should I use NULL or 0? or So, what’s wrong with macros?. It also answers some design questions, like, about final keyword or pointers and references. However you should read Design and Evolution of C++ to understand the philosophy behind the C++ design.

These are not mandatory rules, just Stroustrup’s take on certain issues that can solve some everyday problems/doubts of a C++ programmer. And what better authority than the creator himself. Check it out!

Technorati tags: , ,

Copyright Abhijit Nadgouda.