Wednesday, August 27, 2014

Learning

So far I've learned so much from +Bob Tabor, I'm thankful to him for each and every series I watched (JS fundamentals, C# fundamentals, WP8 fundamentals). Feeling so enthusiastic after learning new technologies that I've cooked some basic applications in the fields. Looking forward to build something bigger. All I need is a little more time.
Happy learning!

Saturday, August 23, 2014

Summers

It's been a long time since I wrote something that is actually about me. Well, here I am spending my summer vacations quite in the way I planned in last semester (huh! what a bad time it was). I actually planned a lot of things to do in summers but I always plan more than I can do so that I do more and more. I am watching movies (a lot), television series, playing games, learning a few things. Recently a lot of people (mostly juniors) have asked me what to do best in summers so that at the end you don't regret that you wasted whole a lot of time doing nothing. I told all of them, "do what needs to be done." Really you should go with your heart. You want to play games? Play them like day and night (literally only stop to eat). You want to go on a tour to some northern areas? Go far away from north. But at the end you shouldn't regret. Regrets are something you keep regretting your whole life.
What I am doing right now?
Well, I am watching Game of Thrones (nearly ended), The Strain and I wish I could mention The Big Bang Theory (God, I miss that badly.)
I am learning C# from learnvisualstudio.net (a video lecture series compiled by Bob Tabor, really a good one for absolute beginners).
I am reading some books to cover the old topics from data structures course and discrete mathematics.
I plan to hit a game in future (in some days) before I leave for Karachi (still planning).

Thursday, August 7, 2014

The `override` Keyword in C++11

Since C++11 has been released, a lot of new things are added in newer versions of working draft (available at http://www.open-std.org/jtc1/sc22/wg21/). Recently I've come to know about the `override` keyword (which is not actually a `keyword` but an identifier with a special meaning).

A very good description with code example is given in this link below,
http://stackoverflow.com/questions/18198314/override-keyword-in-c

Key points are,
  1. Works with virtual functions.
  2. The identifier `override` makes sure that the base class has the same function signature if you write override specifier after some virtual function in derived class.
  3. Quoting working draft C++11 N3242 (published on 28-Feb-2011),
    If a virtual function is marked with the virt-specifier override and does not override a member function of a base class, the program is ill-formed.

Initializing a Constant Pointer

A little off-road but still something was whispering in my head, "can you initialize constant pointer pointing to constant pointer pointing to constant pointer pointing to an integer constant?". Well why not.
Trick was just to send initialized pointers into initializer of previous pointers.
Normally you don't need this scenario. Though creating constant pointers and putting a lot `const` specifiers in a pointer declaration makes the pointer `safe` to be manipulated.

What if you need to initialize an array if you've the same pointer declared. It can be way more tacky and might result into `impossible`.
You can simply declare a pointer and pass it to the function where the parameter is accomplishing all that safety you require from some critical section you want your pointer to stay safe in.
For example,