How I found interesting things about C and C++ languages while learning Symbian C++
March 17, 2010 1 Comment
It is interesting to see that while reading Symbian C++ code you discover things related to C or C++ language that are not quite the same as you already knew them.
Due to the limitations that a smart-phone has (mostly in terms of power consumption which, from a software perspective, translates into number of CPU cycles required to do something, and in terms of memory size), its corresponding software has to tackle in a very accurate manner some aspects which could be neglected by a PC desktop programmer.
I remember that while browsing a Symbian documentation I read somewhere that:
C++ introduces a memory overhead compared to C (a program compiled in C++ will be bigger than one compiled in C), so if you decide for writing an operating system in C++ you have to be more careful than when writing in C.
One thing which kept my attention when having first contact with Symbian was the fact that you should always use the appropriate data types. This was not very surprising for me taking into account that I have an embedded programming background and I know that I have to be very careful when using unsigned int and when int.
But this is not everything. Symbian even has dedicated typedef’ed data types for each C built-in type (except char and void), and it is strongly recommended to use those instead of C types.
While looking at some examples in Symbian C++ other strange things, like inline constructors, private copy-constructors, private static methods, overloading the new operator with new(ELeave), macros like TRAP and TRAPD, popped into my attention and revealed hidden aspects of C++ language.
Generally if you know C++ it would be quite simple to start writing software for Symbian smartphones. But if this is true, why I read everywhere about the steep Symbian learning curve?
