I have just posted a page in the site, about a recent project I’ve done, implementing a simple stack-based calculator, similar to those HP ones: it is called Calculator, and you can find it under the Project pages.
There are several ideas behind this project:
- Create a command-line application using C++, in such a way that the same source code could be used to create executables for the Mac OS X, Linux and Windows.
- Have a good suite of unit tests for the different modules of the application, using CppUnit.
- Give a test drive to Doxygen and “dot”, to generate a full CHM file plenty of diagrams and explanations about the solution.
- Create the application using as many IDEs as possible:
- Eclipse
- Visual Studio (6.0, .NET 2003 and Express 2005)
- Apple Project Builder
- Apple Xcode
- Compile the application using the biggest possible number of compilers:
- Borland’s free command line tools
- Microsoft (3 different versions)
- GCC (under Windows, Mac OS X and Linux)
- Learn the basic syntax of makefiles and provide one for each target platform (the Windows version uses MinGW)
- Make the source code available as “Public Domain” for others to test it, and play with it.
I have learnt several things doing this:
- For some reason, dynamic libraries on the Mac have the “dylib” extension, while in Linux they are “so” files (“shared objects”). They are the equivalent of DLLs in Windows. Other than the naming different, they are used almost the same way.
- Eclipse is a great thing; I could open the project without problem in the three environments.
- Microsoft compilers generate much, much smaller executables than GCC; I would really know why!
- CppUnit works like a charm in all possible environments, exactly as I wanted.
- C++ is an incredible language. I just use 0.1% of what it can do, but I really liked it.
- Doxygen is something out of this planet.
Feel free to download it and tell me your thoughts about it!