On Sat, Oct 6, 2012 at 9:59 AM, Dmitri Gribenko <[email protected]> wrote:
> Author: gribozavr
> Date: Sat Oct  6 11:59:15 2012
> New Revision: 165363
>
> URL: http://llvm.org/viewvc/llvm-project?rev=165363&view=rev
> Log:
> List of potential checkers: more C++11 details for the smart pointer checker.
>
> Modified:
>     cfe/trunk/www/analyzer/potential_checkers.html
>
> Modified: cfe/trunk/www/analyzer/potential_checkers.html
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/www/analyzer/potential_checkers.html?rev=165363&r1=165362&r2=165363&view=diff
> ==============================================================================
> --- cfe/trunk/www/analyzer/potential_checkers.html (original)
> +++ cfe/trunk/www/analyzer/potential_checkers.html Sat Oct  6 11:59:15 2012
> @@ -266,10 +266,12 @@
>  <col class="namedescr"><col class="example"><col class="progress">
>  <thead><tr><td>Name, 
> Description</td><td>Example</td><td>Progress</td></tr></thead>
>
> -<tr><td><span class="name">smartptr.AutoPtrInit<br>
> -(C++03)</span><br><br>
> -auto_ptr should store a pointer to an object obtained via new as allocated
> -memory will be cleaned using delete
> +<tr><td><span class="name">smartptr.SmartPtrInit<br>
> +(C++)</span><br><br>
> +C++03: auto_ptr should store a pointer to an object obtained via new as 
> allocated
> +memory will be cleaned using delete<br>
> +C++11: unique_ptr and shared_ptr allow
> +to specify a custom deleter to handle the new[]/delete[] case correctly

unique_ptr actually doesn't need extra work from the user - if you use
unique_ptr<T[]> instead of unique_ptr<T>, that is.

shared_ptr isn't ideal for holding arrays (doesn't provide operator[]
for one thing) but, yes, with a custom deleter it can at least do so
correctly

(& of course with custom deleters both of these can handle completely
unrelated resource allocation/deallocation strategies)

>  </td><td><pre>
>  #include &lt;stdlib.h&gt;
>  #include &lt;memory&gt;
>
>
> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to