do we need to create an pointer validation for gcnew
<p>1) Do we need to have a pointer validation for following code in cli. Is it good to have?</p>

<pre><code>NameClass NameString^ = gcnew NameClass();

if (NameClass)
{
   // some process
</code></pre>

<p>2) If we created a memory in one function and passing as pointer to other do we need to have validation ? </p>

<pre><code>foo()
{
  try {
         NameClass *pNameString = new NameClass();
         foo_2(pNameString);
      } catch(std::bad_alloc &amp;error)
         {
            std::cout &lt;&lt; error.what() &lt;&lt; std::endl;
         }
}

foo_2(NameClass *pNameString)
{
   if (pNameString)  // do we need to validate here ?
   {
     // some stuff
   }
}
</code></pre>

<p>3) Do we need to validate locally created object in reference passing ? </p>

<pre><code>NameClass objNameClass;
foo(&amp;objNameClass);

foo(NameClass *objNameClass)
{
  if (objNameClass) // do we need to validate here ?
  {
</code></pre>