<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sireesha Cheemakurthy on Medium]]></title>
        <description><![CDATA[Stories by Sireesha Cheemakurthy on Medium]]></description>
        <link>https://medium.com/@sireeshac?source=rss-111a31695503------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LIs14BRhBAKMnR6E8hsnyg.jpeg</url>
            <title>Stories by Sireesha Cheemakurthy on Medium</title>
            <link>https://medium.com/@sireeshac?source=rss-111a31695503------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 10:39:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sireeshac/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[C++ Interview topics]]></title>
            <link>https://medium.com/@sireeshac/c-interview-topics-8f0e5615ecce?source=rss-111a31695503------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f0e5615ecce</guid>
            <category><![CDATA[interview-preparation]]></category>
            <category><![CDATA[cpp]]></category>
            <dc:creator><![CDATA[Sireesha Cheemakurthy]]></dc:creator>
            <pubDate>Fri, 17 Mar 2023 08:31:22 GMT</pubDate>
            <atom:updated>2023-03-21T13:14:32.094Z</atom:updated>
            <content:encoded><![CDATA[<p>Preparing for C++ interviews?</p><p>I have attended many interviews specially asking for C++. Below are the topics I identified to have a good knowledge of, before attempting the interview.</p><p>Advanced C++ concepts</p><ul><li>Lambda function</li><li>rvalue, lvalue and move semantics</li><li>Smart pointers — unique and shared with own implementation</li><li>Various construction initializations (Ref Book: Inside C++ object model by Stanley Lippman — excellent book)</li><li>STL — usage and basic internal implementation</li><li>Templates — generic, partial and full specialization, variadic templates — how and when each type is generated</li><li>Function pointers</li><li>Perfect forwarding</li><li>Pragmas — file guards etc.,</li><li>Name mangling, usage of extern C</li><li>Virtual functions — internal implementation</li><li>Virtual classes</li><li>Dynamic polymorphism</li><li>Operator overloading, function overloading</li><li>Exception handling</li><li>Pointer to member variables and member functions</li><li>References — initialization, when and how to and not to use</li><li>Casting operators</li><li>Mutable, const, override, final, inline</li><li>volatile, extern, static</li><li>Size of object — e.g. size of object with no member variables etc.,</li></ul><p>Additionally good to have knowledge of design patterns — main patterns I observed to be asked are factory, singleton, observer but prepare all.</p><ul><li>SOLID principles</li><li>Abstraction, inheritance, Aggregation and composition</li></ul><p>It will take hardly a day or two to revise all of these if you are familiar with these topics before.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f0e5615ecce" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Who Are We (Thought Journal#1)]]></title>
            <link>https://medium.com/@sireeshac/who-are-we-thought-journal-1-e62324f565a0?source=rss-111a31695503------2</link>
            <guid isPermaLink="false">https://medium.com/p/e62324f565a0</guid>
            <category><![CDATA[weird-fiction]]></category>
            <dc:creator><![CDATA[Sireesha Cheemakurthy]]></dc:creator>
            <pubDate>Sun, 15 Jan 2023 14:16:04 GMT</pubDate>
            <atom:updated>2023-01-16T22:41:33.939Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*o4bsjT8ixanccCgQU5CpjQ.jpeg" /><figcaption>Image source: google</figcaption></figure><p>I have been watching a lot of sci-fi/philosophical series lately . So, one of the weird theories popped up in my brain -</p><p>Have you ever thought that, there might be various levels of existence like levels of game and humans might be somewhere in medium level (given intelligence + suffering) and once we complete this level successfully, we can transform into higher level may be a higher dimension beyond our comprehension(I am aware that some religions might have similar metaphors)</p><p>Every single experience we have, every emotion we feel, every struggle we have to pass through, gains i.e., things we acquire in life(material/non-material) to make our survival easier and missteps we take, like negative points in a game. Every thing is a challenge, every person is unique with unique abilities by birth and born in unique environment with unique challenges. Although no one knows, what dictates it. May be everything you posses is exactly what you need to overcome the challenges you face and more important feature is adaptability through observation and learning which in turn gives you more strength to exist longer in this game level.</p><p>The thing is that people don’t know they are in a game, some struggle to find their direction, some struggle even to become aware of their own abilities, some will be able to discover all the abilities and further enhance them and survive so well while many struggle to become aware of their abilities. No one knows the rules clearly. Basically, no one knows the game may be because rules are not same for everyone and there is no one way of playing it? Somehow some people learn lot more rules of the game than others by trail and error or by design itself, they survive longer and happier. Some understand the rules but ponder on why, who and what’s beyond these rules? Some people never becomes aware of any rules and plays randomly, for those lucky ones, all those random moves turns out to be the right moves. Imagine waking up suddenly one day only to find yourself as a character in a video game with all your previous memory erased and not programmed with any rules of the game, you have to learn on the fly, you may or may not get external help or from other characters, but sooner or later, you should learn how to play the game your own way, about your own abilities and how you can best utilize them to survive. Cheers fellow player !</p><p>Topics: Alternate theory, philosophy, evolution, game theory, journal.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e62324f565a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stack unwinding during exception handling in C++]]></title>
            <link>https://medium.com/@sireeshac/stack-unwinding-during-exception-handling-in-c-c814c5ddfbe0?source=rss-111a31695503------2</link>
            <guid isPermaLink="false">https://medium.com/p/c814c5ddfbe0</guid>
            <category><![CDATA[cpp]]></category>
            <category><![CDATA[exception-handling]]></category>
            <dc:creator><![CDATA[Sireesha Cheemakurthy]]></dc:creator>
            <pubDate>Sat, 21 Mar 2020 12:49:17 GMT</pubDate>
            <atom:updated>2020-03-22T00:46:44.363Z</atom:updated>
            <content:encoded><![CDATA[<p>Before diving into what happens when an exception is thrown in Cpp, let’s look at some of the low level stuff. Little knowledge of stack frames would be helpful in better understanding.</p><h4><strong>Stack and stack frame:</strong></h4><p>We all know that stack for the program under execution holds the memory for all the local variables. So, how are the local variables in a multi level function call gets stored (i.e., when one function calls other function which in turn calls another function and so on).</p><figure><img alt="Layout of program memory and stack memory." src="https://cdn-images-1.medium.com/max/978/1*k62BTaO-x-2FPRKxkWXYaA.png" /></figure><p>The picture on the above left shows basic segments of an executing program in memory (assuming stack grows from lower to higher addresses). If you see in detail about stack, stack is comprised of stack frames. Each stack frame corresponds to one function call. There are two pointers useful for accessing addresses on stack. Frame pointer(stored in bp register on x86) points to the beginning of the stack frame and stack pointer(stored in sp register on x86) points to the top of the stack (i.e., end of the innermost frame). Consider the below code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/310/1*J_aqowns9eoUN_WgNWxi0g.png" /></figure><p>Consider <em>main()</em> function is called for execution. A stack frame(also called activation record) is created for <em>main()</em> with frame pointer(bp) pointing to start of stack and stack pointer(sp) pointing to end of the stack. Now consider <em>fun00()</em> is called inside <em>main()</em>.</p><p>1.The value in the current frame pointer is pushed onto the stack.</p><p>2. Stack pointer which is pointing to top of the stack is copied to the frame pointer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*HO8fX9a2mFYToLWG3SB_UA.png" /></figure><p>3. Input parameters are (in our case variable c ) pushed onto the stack.</p><p>4. Memory for local variables if any would be allocated on stack.(in our case variable x)</p><p>5. Now there is another function call to <em>fun01()</em>, steps 1- 4 are repeated and new frame is created.</p><p>6. Inside <em>fun01()</em>,<em> fun02()</em> is called and again steps 1– 4 are repeated.</p><p>Now let’s see what happens to stack, when you reach the end of <em>fun02()</em> i.e., exiting from <em>fun02()</em>.</p><h4>Stack Unwinding:</h4><p>So, now we know we have four functions called from inside of each function i.e., main(frame0) calls fun00(frame1) which calls fun01(frame2) which calls fun02(frame3). This creates four stack frames on our stack.</p><p>Now, let’s see what happens when we reach the end of each function.</p><p>Once we reach end of <em>fun02()</em>,</p><ol><li>All local variables stored in the stack frame would be destroyed and freed in the reverse order.</li><li>Input variables would be destroyed and freed i.e., free up all resources consumed by stack frame.</li><li>Frame pointer is copied to stack pointer.</li><li>Address of previous frame pointer stored on the stack is loaded into frame pointer.</li></ol><p>Now the stack frame is completely destroyed.</p><p>The same steps would be repeated for the remaining functions as well once the end of respective functions are reached.</p><h4>Exception handling:</h4><p>Exception handling mainly deals with two blocks: try block and catch block. Try block is that block of code from where an exception arises. Catch block does the job of handling the exception thrown from try block.</p><figure><img alt="Simple exception handling" src="https://cdn-images-1.medium.com/max/582/1*lWqfaO6I3ltt7Bu3SdWvuQ.png" /></figure><p>The above example shows that exception is thrown in main and corresponding catch block is also in main.</p><p>Suppose if the exception is thrown in innermost function and if there is no corresponding catch block within that function the exception would be propagated to the outer functions in the call stack one after the other till a corresponding catch block catches the exception.</p><p>Let’s see a simple example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*SALJYj5yoCEhqpI_pHOnUg.png" /></figure><ol><li>Here we have three functions: <em>main </em>calling <em>fun00,</em> <em>fun00 </em>calling <em>fun01.</em></li><li>Once the execution reaches to he inner function <em>fun00 </em>and exception is thrown.</li><li>Execution of <em>fun00 </em>terminates there itself and <em>fun01 </em>is not called.</li><li>The <em>exception </em>propagates one level up to main function. what about the <em>local variables p and obj0</em>? (Fig 3 gives the location of these variables and location of memory pointed by these variables.)</li></ol><p>Remember our stack unwinding process described above?</p><p>Before the <em>exception </em>propagates from <em>fun00 </em>to main, stack frame corresponding to <em>fun00 </em>would be destroyed i.e., destructor of <em>obj0 </em>is called and memory allocated for pointer variable <em>p</em> on the stack would be freed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/255/1*h5mfTLXZcVtzW60UsvpWpg.png" /></figure><p>Exception would be caught in main function and remaining part of main would be executed as expected.</p><p>In this way, <strong>exception would be propagated one level by one level above, till a corresponding catch block is found</strong> and all the intermediate <strong>stack frames would get removed through the process of stack unwinding.</strong></p><p>Well, all good till now. But there’s one problem in our example above. Have you figured it out yet?</p><p>In the above example, <em>fun00 </em>contains pointer <em>p </em>and <em>obj0</em>. Memory allocated for <em>p </em>and <em>obj0 </em>is deallocated, <em>obj0 </em>destructor is called and memory for <em>obj0.a</em> is deallocated.</p><p>What about the memory pointed by pointer p which is on heap? No one deallocates that memory and we lost the reference to that memory as well causing memory leak. <strong>“Well, Smart pointers comes to our rescue here!!!”</strong> And if you carefully observe infact our <em>Class A</em> does what a smart pointer does(ofcourse, few more add-ons needed)!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c814c5ddfbe0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>