C++ jargon

Initially I thought of writing a new part in my series of C++ teachings, but I changed my mind. I start reading a C++ FAQ and I kept reading and reading. Interesting stuff out there and I strongly recommend to go through (in any case, if you’re making any search about any C++ topic on Google, this will be displayed among first 4-5 most relevant webpages, so it is hard to miss it).

I don’t know whether or not the title indeed reflects the content of this post, but it seemed to me that this FAQ site was depicting the way a C++ programmer thinks. The fact that this post is commenting some of the topics in the aforementioned web-site and that the manner in which some hints are outlined and some C++ insights are explained guided me to the idea that the author is speaking into a “C++ jargon”.

I decided to go through those items and to highlight those which popped to my attention, just as I did it with the video courses. This won’t be some kind of short overview of the FAQ, but only my view of some topics which I considered to be more interesting.

One of the interesting discussions is at topic no6 – Big Picture Issues

One thing which I totally agree upon is that business perspective should rule. The author asks rhetorically:

Is it important to know the technical definition of “good OO“? Of “good class design“?

And then the answer comes:

Read more of this post


How I found interesting things about C and C++ languages while learning Symbian C++

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?

Read more of this post

C++.. PART4

Ok … so let’s go further becasue it seems that this was a quite long-time approach. Anyway I don’t want to wander into useless details but on the other hand I don’t want to miss something that could be important.

18. Class vs Struct – this will be just a discussion about C structs and C++ classes, so emphasizing the main aspects of object oriented programming.
C structures are the part of C language which makes the transition to C++ and object oriented programming. In C they were designed to be more some data
containers, that’s why in C structs you cannot add functions (if it is to take into consideration differences between C++ structs and C++ classes only
the default access type will be considered: public for struct, private for class). When defined a C++ class does not take memory storage, it happens
only when it is instantiated.

But how things are really passing concerning classes’ declaration, definition and instantiation? Basically classes’ definitions are kept in header files and their
declarations and instantiations in source files, in other words everything that does not have an active role in programs’ execution is kept in headers and the program itself, the part that is indeed executed is kept in .c files. This is not mandatory, this is not requested by the standard, but is just a guideline.

Also a frequent practice in designing classes is to declare its members as private and corresponding functions, which access them as public. Actually
this is the very nature of encapsulation, classes’ characteristics are not visible outside of the class but can be modified from within by some functions
which are accessible from outside.

Go on further to #19

Brief guide to Symbian C++

… actually you can find this information on a dozen of other sources, but if you bothered (if this is so I will thank you) to click on my blog, it worth reading it.

Maybe the difference in between what is written here and on some other web resource, is that those things out here are  coming from a Symbian newbie, so …

Symbian developers from all over the world (I am addressing here to the beginners among you)  unissez vous !

Do you already have a C++ background and do you want to start learning about the worlds’ most deployed mobile operating system ? If you happily answer YES to both questions, you may need informations out here.

Many Symbian C++ books assume that you are already familiar with C++ but not that you have an in-depth knowledge of the operating system, actually many of them include some statements like this one:

If you are a developer targeting, or thinking of targeting, Symbian OS, this book will show you how to write the most effective C++. You will benefit from a greater understanding of the characteristic features and design of the operating system, and confidence in how to use them.

the author warns:

We encourage you to follow them too, in order for your own code to be understood most easily by other Symbian OS developers, and because the conventions have been chosen carefully to reflect object cleanup and ownership, and make code more comprehensible. An additional benefit to using the conventions is that your code can then be tested with automatic code analysis tools, which can flag potential bugs or areas to review.

… just taken from Symbian OS explained by Jo Stichbury, a Symbian OS and Symbian C++ golden reference

The general picture being drawn I will procede with Symbian C++ code conventions.

  1. Capitalization – each class name must be capitalized, rest of the letters must be in lower-case.
  2. CClass Instance1; //this is OK
    CCLASS Instance2; //this is NOT OK Go on further