title: Pointer vs. reference return types
body: <p>i'm trying to come up with a concrete reasoning why to use a pointer over a reference 
  as a return type from a function ,</p>
  
  <p>my reasoning is that if inadvertently a null value is returned to a reference type 
  it could not be checked , and could lead to run-time errors </p>
  
  <pre><code>  int&amp; something(int j)
    {
        int* p = 0 ;  
        return *p;
    }
  
    void main()
    {
        int&amp; i = something(5);
        i = 7;   // run-time error 
    }
  </code></pre>
  
  <p>if i had used a pointer i could check it and avoid the error 
  the pointer return value would act as a contract to that a value must be returned.</p>
  
  <pre><code> void main()
   {
           int* i = something(5);
           if( i != null )
               *i = 7;
   }
  </code></pre>
  
  <p>any thoughts would be appreciated 
  again , </p>
  
  <p>what would you use and why 
  reference or pointer</p>
  
  <p>thanks in advance. </p>