<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>C&#43;&#43; on Software Craftsperson</title>
    <link>https://www.softwarecraftsperson.com/tags/c&#43;&#43;/</link>
    <description>Recent content in C&#43;&#43; on Software Craftsperson</description>
    <image>
      <title>Software Craftsperson</title>
      <url>https://www.softwarecraftsperson.com/logos/web/png/Color%20logo%20-%20no%20background.png</url>
      <link>https://www.softwarecraftsperson.com/logos/web/png/Color%20logo%20-%20no%20background.png</link>
    </image>
    <generator>Hugo -- 0.147.1</generator>
    <language>en</language>
    <lastBuildDate>Wed, 18 Jul 2012 11:02:00 +0100</lastBuildDate>
    <atom:link href="https://www.softwarecraftsperson.com/tags/c++/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Static in C&#43;&#43;</title>
      <link>https://www.softwarecraftsperson.com/posts/2012-07-18-static-in-c/</link>
      <pubDate>Wed, 18 Jul 2012 11:02:00 +0100</pubDate>
      <guid>https://www.softwarecraftsperson.com/posts/2012-07-18-static-in-c/</guid>
      <description>&lt;p&gt;Hey, its been a really long time.&lt;br&gt;
I couldn&amp;rsquo;t get my adsense account approved.&lt;br&gt;
It seems I need more content.&lt;br&gt;
If only I spend enough time blogging. Everyone gets busy once in a while. And everyone forgets that they have a blog. Especially ones like mine, where people rarely visit.&lt;br&gt;
Anyways, that&amp;rsquo;s relevant to what I wanted to make note of here.&lt;br&gt;
I was working on a minor change in my company&amp;rsquo;s C++ code base.&lt;br&gt;
Its a simple one for anyone who knows C++. But I don&amp;rsquo;t do much C++. The last time I remember writing real C++ code was during my university days. I mean my bachelors degree. During my masters I worked solely on Java based stuff for my projects and for a coursework, I just opted to do something in ASP .NET, just to get a feel of it.&lt;br&gt;
Coming straight back to the point. Static is an overused keyword. Literally it would mean something that doesn&amp;rsquo;t change. But in C++, this keyword has special meanings, depending on the context it is used.&lt;br&gt;
Static can be used for three purposes.&lt;br&gt;
One use is to have a variable defined that has a lifetime of the whole program. That is once you declare it static and initialize it, then that variable&amp;rsquo;s value can be accessed from anywhere in that program. That variable&amp;rsquo;s allocation is cleared up only when the program closes or quits. And it helps prevent re-initialization. If I were to write something like this:&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
