Symbian way of implementing exceptions vs Standard C++ way

One of the most interesting and controversial characteristics of Symbian, is the way in which exceptions are implemented. Why am I saying this? Because opinions are split. Is it easier and faster to use leave-mechanism or is just a useless overhead, also in terms of program size, execution speed but also in getting familiar and learning them?

Browsing through Symbian forums and developers’ communities I read (almost) only positive and pro opinions. I also had the chance to go through codeproject programmers community and I have found an article claiming that Symbian OS is mostly designed in a faulty manner and that Symbian C++ is a very obscure and cumbersome clone of the Standard C++ language. I thought of picking several quotes from this article in order to highlight the way exceptions are implemented in Symbian.

There is a paragraph called “Making the key decision based on false facts and statements”, and exceptions’ implementation is given as being the best example. Here it is stated that the “false” premises that led to the implementation of this mechanism was the fact that: “C++ makes the compiled code to grow with 40% in size”. I would not assume that this was the driving reason of implementing the “leaves-mechanism” along with the “two-phase construction”, since Symbian OS developers worked on this well before Bjarne Stroustrup wrote about C++ exceptions.

But before assuming any fake presumption let’s have a look on how the exception mechanism is implemented in standard C++.

In fact … what is an exception?

Read more of this post

Descriptors – a nightmare?

As far as  I had the chance to google and to browse through some Symbian developer communities and forums, the answer to this question is likely to be positive for a Symbian junior programmer.

Well … what is in my mind when writing about descriptors? Am I a masochist?
I’m trying not to be and also I’m trying to improve  my Symbian expertise. Why? Does it worth spending the time learning about one of the most complicated operating system ever built? It’s quite difficult to answer but for sure this will not make the subject of this post.

What about descriptors … ?

I think one must regards those descriptors like some predefined data types somehow replacing char type from C, due to its inconsistencies we’ve just discussed.

Descriptors can be classified in six categories: whether they are modifiable or not, whether they are pointers or buffers, whether they are heap or stack based.

How can you differentiate them when writing Symbian C++ code?

Basically you can use just the following types: TPtr (pointers), TBuf (stack based), HBuf (heap based), if one of those type has a trailing C, TPtrC, TBufC or HBuf, this is meaning that they are constant. Below is presented the descriptors’ class hierarchy:

In my opinion a very big leap ahead in understanding descriptors is to have an in-depth knowledge of this scheme above.

Read more of this post