<div class="gmail_quote">On Thu, Jan 28, 2010 at 9:30 AM, Jeff Baumes <span dir="ltr"><<a href="mailto:jeff.baumes@kitware.com">jeff.baumes@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Thu, Jan 28, 2010 at 9:24 AM, Wes Turner <<a href="mailto:wes.turner@kitware.com">wes.turner@kitware.com</a>> wrote:<br>
> I'm not really against the idea, but I am not convinced that this actually<br>
> does anything real for us. We are just replacing the line:<br>
> vtkSmartPointer<vtkClass> myLocal = vtkSmartPointer<vtkClass>::New();<br>
> with<br>
> vtkSmartPointer<vtkClass> myLocal(true);<br>
> I don't mind change and will go along with whatever is decided, but we are<br>
> trading conciseness for clarity. I generally don't mind multiple line code,<br>
> so shortening the signature is not a big deal to me. Is there really<br>
> consensus that this is needed?<br>
<br>
</div>I think people will either use this or else some ad hoc macros like<br>
the VTK_CREATE macro that's currently scattered around tests/examples.<br>
Since I've seen several people use a macro (myself included), I think<br>
that shows some sort of consensus that the current length of code<br>
required for initializing smart pointers is unacceptable.<br>
<font color="#888888"><br>
Jeff<br>
</font><div><div></div><div class="h5"><br></div></div></blockquote><div><br></div><div><br></div><div>This is bad:</div><div>VTK_CREATE(vtkClass, myLocal);</div><div><br></div><div>because it hides the fact that a local variable is being declared, it hides the fact that a heap allocation is being made and it makes it hard to step using a debugger.</div>
<div><br></div><div>This is bad:</div><div>vtkSmartPointer<vtkClass> myLocal(true);<br></div><div><br></div><div>because it hides the fact that a heap allocation is being made, and the "true" is meaningless to the novice/casual reader.</div>
<div><br></div><div><br></div><div>The fact that we disallow abbreviations by convention means that we will end up with long names. It would be better to leave things as they are and everybody get over the "waa waa this name is too long" syndrome.</div>
<div><br></div><div>Perhaps since there is no consensus, things should be left alone for now and taken up with the ARB for a decree... ("Talk to the ARB!")</div><div><br></div><div><br></div><div>David C.</div><div>
<br></div></div>