<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>C++ Source &#187; Uncategorized</title>
	<atom:link href="http://cppsource.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://cppsource.com</link>
	<description>Your Source for C++ Information</description>
	<lastBuildDate>Wed, 12 Aug 2009 18:20:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Namespaces</title>
		<link>http://cppsource.com/2009/08/namespaces/</link>
		<comments>http://cppsource.com/2009/08/namespaces/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 18:16:45 +0000</pubDate>
		<dc:creator>carlos</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cppsource.com/?p=79</guid>
		<description><![CDATA[A namespace is a feature that allows classes and functions to be created in a restricted scope, that is, accessible only using the name of the namespace as a qualifier. Namespaces exist to simplify the task of giving names to classes and functions. In C, all structs and functions are in the global namespace (unless [...]]]></description>
			<content:encoded><![CDATA[<p>A namespace is a feature that allows classes and functions to be created in a restricted scope, that is, accessible only using the name of the namespace as a qualifier.</p>
<p>Namespaces exist to simplify the task of giving names to classes and functions. In C, all structs and functions are in the global namespace (unless they are made static). This means that it is very possible that a clash may happen between methods or structs defined in different libraries.</p>
<p>The most common method used to solve this problem in C and earlier versions of C++ was creating prefixes. For example, if a group developed a library called YZ, they would prefix all symbols define by this library with the YZ_ prefix. Therefore, this would prevent a clash with other symbols defined in different libraries.</p>
<p>Modern languages avoid this problem by making all code part of a module, where definitions of symbols are maintained. Symbols can only be referenced by importing a module, according to the rules of the language. For example, Java has packages, C# has assemblies, and Python has modules.</p>
<p>In C++, namespaces are not required, but are strongly encouraged for new development. Using namespaces means that there are less opportunities for clashes with software that was written by other people.</p>
<hr />
<h2><a name="_examples"></a>Examples</h2>
<p>Here is an example of how to define a namespace called &#8220;Example&#8221;:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10">
<tr>
<td>
<pre>namespace Example {
  class A {
   void test();
  }
}</pre>
</td>
</tr>
</table>
<p>Code can be added to a namespace by simply using the namespace block as show above:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10">
<tr>
<td>
<pre>namespace Example {
void A::test() { std::cout &lt;&lt; " a test \n"; }
}</pre>
</td>
</tr>
</table>
<p>To use a class defined in a namespace, you can refer to the fully qualified name (namespace + class name):</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10">
<tr>
<td>
<pre>void test2() {
   Example::A a = new Example::A();
}</pre>
</td>
</tr>
</table>
<p>The second possibility is employing the <tt>using</tt> clause:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10">
<tr>
<td>
<pre>using namespace Example;
void test3() {
   A a = new A();
}</pre>
</td>
</tr>
</table>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fcppsource.com%2F2009%2F08%2Fnamespaces%2F&amp;linkname=Namespaces"><img src="http://cppsource.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://cppsource.com/2009/08/namespaces/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exceptions Inside Exceptions</title>
		<link>http://cppsource.com/2009/08/exceptions-inside-exceptions/</link>
		<comments>http://cppsource.com/2009/08/exceptions-inside-exceptions/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 19:59:22 +0000</pubDate>
		<dc:creator>carlos</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cppsource.com/?p=77</guid>
		<description><![CDATA[One of the risks that we incur when working with exceptions, is having to control what is happening when the exception is received in the catch block. An exception is thrown, as we have seen in the article about exceptions when the keyword throw is used. Then, a new object of the time determining the [...]]]></description>
			<content:encoded><![CDATA[<p>One of the risks that we incur when working with exceptions, is having to control what is happening when the exception is received in the catch block.</p>
<p>An exception is thrown, as we have seen in the <a href="http://cppsource.com/2009/07/exceptions/">article about exceptions</a> when the keyword <tt>throw</tt> is used. Then, a new object of the time determining the exception is created. For  example, we can create a new exception in the following way:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10">
<tr>
<td>
<pre>void Obj::AMethod() {
   // ....
   if (error)
      throw new MyCustomException("something bad happened");
}</pre>
</td>
</tr>
</table>
<p>An exception is catch by a <tt>catch</tt> block that can be added to any code surrounding the place where the exception was thrown. Surrounding here means not only the code that directly throws the exception, but also any code that called the method where the exception is being thrown.</p>
<p>Here is an example:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10">
<tr>
<td>
<pre>void Obj::Example() {
   try {
   // ...
      this-&gt;AMethod();
   } catch (MyCustomException &amp;e) {
      // process the exception here
   }
}</pre>
</td>
</tr>
</table>
<p>The main problem we are concerned about here is what happens between the moment the exception is thrown and the moment the program can restart on the catch block.</p>
<p>The main problem with catching exceptions, is that we need to make sure that no additional exceptions will be thrown during the process of destroying objects. For example, if the code above has an object with a destructor that throws another exception, then we have a problem.</p>
<p>Notice that, when throwing an exception, C++ maintains a context, which determines what destructor will be called in response to the exception. The fact is that all objects created in the context between the place where an exception was thrown until the catch block need to be destroyed.</p>
<p>If we send an exception during the destruction process, then C++ can become confused about what objects needs to be destroyed as a result. It is as if there were are double queue of objects that need to have their destructor called.</p>
<p>In such a situation, C++ won&#8217;t know what to do, and the program will simply stop working correctly and crash.</p>
<p>To avoid problems like this, the main suggestion is that we should avoid throwing exceptions on a destructor. We never know in what context a destructor will be called, so it is better to avoid throwing exception on any destructor.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fcppsource.com%2F2009%2F08%2Fexceptions-inside-exceptions%2F&amp;linkname=Exceptions%20Inside%20Exceptions"><img src="http://cppsource.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://cppsource.com/2009/08/exceptions-inside-exceptions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exceptions</title>
		<link>http://cppsource.com/2009/07/exceptions/</link>
		<comments>http://cppsource.com/2009/07/exceptions/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 20:39:29 +0000</pubDate>
		<dc:creator>carlos</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cppsource.com/?p=65</guid>
		<description><![CDATA[An exception is an indication that something unexpected occurred in a C program. The mechanism used by C to handle exceptions is using the try/catch pair of keywords. An exception is represented in C++ by an object that encodes the condition that caused the exceptional event. One can use this object by means of the [...]]]></description>
			<content:encoded><![CDATA[<p>An exception is an indication that something unexpected occurred in a C<tt> program. The mechanism used by C</tt> to handle exceptions is using the try/catch pair of keywords.</p>
<p>An exception is represented in C++ by an object that encodes the condition that caused the exceptional event. One can use this object by means of the throw keyword.</p>
<p>The try/catch mechanism allows one to create a context in which we can protect against exceptions. For example</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10">
<tr>
<td>
<pre>class MyException { /* ... */ }
int i = 0;
try {
  i = performCalculation();
}
catch (MyException &amp;e) {
   cout &lt;&lt; "an exception occurred\n";
}</pre>
</td>
</tr>
</table>
<p>Observations: * note that in the catch clause, the exception is taken by reference. This is useful to avoid the need of copying the object.</p>
<p>Once you detect an exceptional condition, the exception can be throw using code like this:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10">
<tr>
<td>
<pre>if (conditionHappened)
  throw new MyException();</pre>
</td>
</tr>
</table>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fcppsource.com%2F2009%2F07%2Fexceptions%2F&amp;linkname=Exceptions"><img src="http://cppsource.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://cppsource.com/2009/07/exceptions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Variables in C++</title>
		<link>http://cppsource.com/2009/07/variables-in-c/</link>
		<comments>http://cppsource.com/2009/07/variables-in-c/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 19:34:49 +0000</pubDate>
		<dc:creator>carlos</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cppsource.com/2009/07/variables-in-c/</guid>
		<description><![CDATA[Programming is all about creating change in the way information is stored in a computer. To make this possible, we need easy access to the contents of computers memory. This is what programming language variables allow us to do: they give a simple way to store and retrieve information into the computer&#8217;s memory. It may [...]]]></description>
			<content:encoded><![CDATA[<p>Programming is all about creating change in the way information is stored in a computer. To make this possible, we need easy access to the contents of computers memory. This is what programming language variables allow us to do: they give a simple way to store and retrieve information into the computer&#8217;s memory.
</p>
<p>It may come as a surprise to you that we, as programmers of high level applications, have direct access only to locations in the random access memory (RAM). Whenever it is necessary to have access to disks, the network servers, or other types of store memory, this is done in an indirect way, through manipulation of main memory.
</p>
<p>A variable is a named memory, that can be used to read and write information. In this sense, variables are nothing more than &#8220;buckets&#8221; that can be used to store whatever values are needed for a specific computation. However, as different materials require different containers, we also have different types of variables for the various contents that can be stored in it.
</p>
<p>Suppose, for example, that the value to be stored is an integer number. In C++ this is called an int, and there is a specific declaration for each variable of the integer type, so the computer knows  that only integers will be stored in that location.
</p>
<h2>Types of variables<br />
</h2>
<p>There are just a few basic variable types in C++. They can be either numeric (such as integers and floating point numbers) , characters (such as the letters of the alphabet), or Booleans (representing the values true or false). What makes C++ rich is the several ways in which these basic building blocks can be combined. For example, one can have sequences of variables, variables that can be negative (signed) or only non-negative (unsigned),  or variables that have more or less space to store values (short or long). Moreover, C++ allows these basic variable types to be combined into complex data objects, as we will see later in this book.
</p>
<p>
 </p>
<h2>The basic types are the following:<br />
</h2>
<p><strong>Integers</strong>: they are declared using the keyword int. They represent integer number that are positive or negative. The limit on the integer size is dictated by the architecture in which the compiler has been implemented. Many modern computers store integers in four bytes, thus 2^32 is a practical limit for the values that can be stored in an integer variable.
</p>
<p><strong>Floating point numbers</strong>: Floating point numbers are used to represent real numbers in an approximate way. Remember that real numbers may have an infinite representation (for example, Pi), therefore only approximations can be stored in a computer. C++, as its antecessor C, has two main types for floating point numbers: float and double. A double is supposed to have more storage capacity than floats, and this is usually the case depending on the computer used. Although both types are available, its considered better to used only doubles to avoid rounding problems.
</p>
<p><strong>Characters</strong>: a character, declared as a char, can be used to store any alphanumeric values, such as the letters from &#8216;a&#8217; to &#8216;z&#8217;, numeric values from &#8217;0&#8242; to &#8217;9&#8242; when they are not interpreted as numbers, and other codes such as punctuation symbols, etc.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fcppsource.com%2F2009%2F07%2Fvariables-in-c%2F&amp;linkname=Variables%20in%20C%2B%2B"><img src="http://cppsource.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://cppsource.com/2009/07/variables-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Virtual Functions in C++</title>
		<link>http://cppsource.com/2009/04/virtual-functions-in-c/</link>
		<comments>http://cppsource.com/2009/04/virtual-functions-in-c/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 15:12:16 +0000</pubDate>
		<dc:creator>carlos</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cppsource.com/?p=49</guid>
		<description><![CDATA[Object oriented programming is a style of programming that requires that functionality be attached to objects, instead of freely available through functions. C++, although not being a pure object oriented language, supports the notion of objects and classes of objects. One of the big advantages of programming with objects is that they can behave differently [...]]]></description>
			<content:encoded><![CDATA[<p>Object oriented programming is a style of programming that requires that functionality be attached to objects, instead of freely available through functions. C++, although not being a pure object oriented language, supports the notion of objects and classes of objects.</p>
<p>One of the big advantages of programming with objects is that they can behave differently based on who the messages are sent to. This kind of dynamic behavior is called polymorphism, and is implemented in C++ by the virtual function mechanism.</p>
<hr />
<h2><a name="_what_is_a_virtual_function"></a>What is a virtual function?</h2>
<p>A virtual function is a member of a class that can be overriden by a derived class to provide different functionality.</p>
<p>For example, a member function <tt>draw</tt> can be used to determine how a graphical object is drawn on the screen. Depending on the concrete type of the object, however, the shape of the object may change, and the way it is drawn will be different. The function <tt>draw</tt> in this case is a candidate to be implemented as a virtual function, which will have different implementations for each of the concrete classes.</p>
<hr />
<h2><a name="_creating_virtual_functions_in_c"></a>Creating virtual functions in C++</h2>
<p>A virtual function can be created in C++ with the use of the virtual keyword before the declaration of the member function. For example:</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10">
<tr>
<td>
<pre>class Button {
  virtual void draw() {
    // drawing a generic button
  }
};

class RoundButton {
  virtual void draw() {
    // draw button with a different shape
  }
}</pre>
</td>
</tr>
</table>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fcppsource.com%2F2009%2F04%2Fvirtual-functions-in-c%2F&amp;linkname=Virtual%20Functions%20in%20C%2B%2B"><img src="http://cppsource.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://cppsource.com/2009/04/virtual-functions-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Class Access Levels</title>
		<link>http://cppsource.com/2009/04/class-access-levels/</link>
		<comments>http://cppsource.com/2009/04/class-access-levels/#comments</comments>
		<pubDate>Mon, 20 Apr 2009 15:47:55 +0000</pubDate>
		<dc:creator>carlos</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cppsource.com/?p=35</guid>
		<description><![CDATA[C++ provides three access levels for members of a class. Both member variables and member functions can be tagged as public, private, or protected, depending on the intended use of the member in the class. A public data member of member function is one that can be accessed by any user of the class, independent [...]]]></description>
			<content:encoded><![CDATA[<p>C++ provides three access levels for members of a class. Both member variables and member functions can be tagged as public, private, or protected, depending on the intended use of the member in the class.</p>
<p>A public data member of member function is one that can be accessed by any user of the class, independent of where the user is located. Thus, member functions that are declared public can be accessed anywhere, and represent the public interface of a C++ class.</p>
<p>Public member variables are also allowed to be viewed anywhere in the program. However, allowing this to happen is usually not a good idea, since it would inibit future changes in the representation of the data stored in a class. Unless you really need to do this for some reason (for example, compatibility with C code), you should avoid the creation of public member variables in a C++ class.</p>
<p>Private member variables, on the other hand, are not visible outside the class where they are declared. This is the preferred way of declaring member variables in C++, since it guarantees that the usage of data is limited to the class itself.</p>
<p>Like private member variables, private member functions are also useful in C++ programs. Such member functions are used in the implementation of the class, and are not accessible to users of the class. Every member function that is not part of the interface should be made private (or at least protected).</p>
<p>In fact, C++ defines private access as the default level of access for class member. That is, if you don&#8217;t specify anything as the access level, then the member will be considered private.</p>
<p>The other level of accessibility is the protected level. A member function or member variable is protected if it is accessible only inside a class or by the classes that derive from it. Therefore, only classes that inherit from the class where the member is contained can have access to the function or variable.</p>
<p>Protected members of a class are useful to provide functionality for derived classes. However, they should be used with care. One of the main problems, is that classes that expose too many details to derived classes may have difficulties when changing their internal representation, since an unspecified number of derivate classes may be using the protected information.</p>
<hr />
<h2><a name="_example"></a>Example</h2>
<p>Here is an example of the access level described above. Note that the method Director::getInfo() incorrectly tries to access getAge, since it is a private method.</p>
<table border="0" bgcolor="#e8e8e8" width="100%" cellpadding="10">
<tr>
<td>
<pre>class Employee {
  // private member variable
  int age;
  // private member function
  int getAge() { return age; }
public:
  // public member variable (don't do this!)
  std::string name;
  std::string getName() { return name; }
protected:
  // these members are visible only inside Employee
  // and derived classes
  std::string telephone;
  std::string getTelephone() { return telephone; }

};

// A derived class
class Director : public Employee {
   public:
   void getInfo();
};

void Director::getInfo() {
   // this works - protected
   cout &lt;&lt; getTelephone() &lt;&lt; "\n";
   // this doesn't work - private to Employee
   cout &lt;&lt; getAge() &lt;&lt; "\n";
}</pre>
</td>
</tr>
</table>
<table frame="void" cellpadding="8">
<tr valign="top">
<td>
<p><b><u>Important</u></b></p>
</td>
<td style="border-left: 1px solid silver;">Don&#8217;t forget to add the public: tag before public members. Remember that the default access level in C++ is private.</td>
</tr>
</table>
<ul>
<li>Buy <a href="http://www.amazon.com/gp/product/0201700735?ie=UTF8&#038;tag=bookdablogonb-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=0201700735">The C++ Programming Language: Special Edition (3rd Edition)</a><img src="http://www.assoc-amazon.com/e/ir?t=bookdablogonb-20&#038;l=as2&#038;o=1&#038;a=0201700735" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /> at Amazon.</li>
</ul>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fcppsource.com%2F2009%2F04%2Fclass-access-levels%2F&amp;linkname=Class%20Access%20Levels"><img src="http://cppsource.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://cppsource.com/2009/04/class-access-levels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the assert macro in C++</title>
		<link>http://cppsource.com/2009/04/using-the-assert-macro-in-c/</link>
		<comments>http://cppsource.com/2009/04/using-the-assert-macro-in-c/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 03:44:53 +0000</pubDate>
		<dc:creator>carlos</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://cppsource.com/?p=27</guid>
		<description><![CDATA[Writing good software is a difficult proposition. It is sometimes easy to write sub-par software, with a high number of defects and poor maintainability, but to make sure that software has good quality and is easy to modify one needs to take care of many issues. One of the necessary factors in creating good software [...]]]></description>
			<content:encoded><![CDATA[<p>Writing good software is a difficult proposition. It is sometimes easy to write sub-par software, with a high number of defects and poor maintainability, but to make sure that software has good quality and is easy to modify one needs to take care of many issues.</p>
<p>One of the necessary factors in creating good software is guaranteeing that it satisfy its requirements. One of the simplest methods for doing this is using the assert facility provided by the standard C++ library.</p>
<h3>Using Assert</h3>
<p>Assert is a mechanism that allows a program to stop an error in its tracks whenever it is detected.  Assert is implemented in C++ as a macro, where the first argument is a boolean expression. This expression is evaluated, and its result is always expected to be true.</p>
<p>For example, the following is a typical use of assert:</p>
<p>void test(int value) {<br />
  assert(value &gt; 0);<br />
  // normal processing<br />
} </p>
<p>In the example above, the assert tests if the argument passed to function test is greater than zero. If this is true, processing continues as normal. However, in the case that value is negative or zero, the assertion fails and the program stops immediately.</p>
<p>The assert <a href="http://in4mationflow.com/Cplusplus/CLibFunctions/assert">macro is defined in assert.h</a>, a header file that is  also used by the C compiler &#8212; so you can use assert on C or C++.</p>
<p>Using assert in a testing environment is a first step towards guaranteeing that we have the correct values before our algorithm starts. It is an easy method and has been effectly used in this way by many experienced programmers. </p>
<h3>Disadvantages of Assert</h3>
<p>Although there are many advantages on using assert, one also needs to be aware of the problems in its use. First, asserts are not a substitute to using exceptions. When there is a possibility of recovery from an error, then the exception mechanism should be used. This way, the programmer has control over how a failure in the code must be handled. With an assert, on the other hand, the whole program stops.</p>
<p>In general, asserts should not be used on production code. The reason is that asserts are not graceful, they just stablish that an error ocurred, and stop the program. This is certainly not the behavior required in production, where the appropriate steps need to be taken to guarantee that user data is preserved.</p>
<h3>Conclusion</h3>
<p>Asserts are a powerful mechanism provided by C++ to guarantee that certain conditions are present on a specific function. If the expression given as input is not true, then the assert will automatically call the attention of the developer.</p>
<p>Asserts should be used sparingly, however, and not at all in production. Thankfully, all implementations of assert have a mechanism to disable it in production code. Check the documentation of NDEBUG in your favorite compiler for the details.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fcppsource.com%2F2009%2F04%2Fusing-the-assert-macro-in-c%2F&amp;linkname=Using%20the%20assert%20macro%20in%20C%2B%2B"><img src="http://cppsource.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://cppsource.com/2009/04/using-the-assert-macro-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
