[Insight-developers] itkGetConstMacro versus itkGetConstReferenceMacro

Bill Lorensen wlorens1 at nycap.rr.com
Sun Nov 7 07:38:41 EST 2004


Luis,
I changed all GetConstMacro to GetConstReferenceMacro. I left the old macro 
in itkMacro.h for compatibility. I suppose we could change its 
implementation to match the GetConstReference.

Bill

At 10:13 PM 11/5/2004, Luis Ibanez wrote:

>I agree in that returning a const reference is always better
>than returning the copy.
>
>Actually it seems by having
>
>       itkGetConstReferenceMacro()   and
>       itkGetConstObjectMacro()
>
>we shouldn't need
>
>       itkGetConstMacro().
>
>
>
>   Luis
>
>
>-----------------------------------------
>Lorensen, William E (Research) wrote:
>
>>Jim and I found a nasty bug yesterday that was related to the use of
>>GetConstMacro. It's a long story, but the Get should have returned a
>>reference rather than a copy.
>>Last night, I replaced all GetConstMacro usage with GetConstReferenceMacro.
>>Everything compiled and all tests passed on Borland and VS7.
>>Can anyonoe think of a reason why this would be a bad move. Certainly,
>>performace should be slightly better with the reference macro since a new
>>version of the ivar need not be created.
>>If there are no objections, I'll check this in later today. I'm building
>>InsightApplications now.
>>Bill
>>_______________________________________________
>>Insight-developers mailing list
>>Insight-developers at itk.org
>>http://www.itk.org/mailman/listinfo/insight-developers
>
>
>
>
>
>_______________________________________________
>Insight-developers mailing list
>Insight-developers at itk.org
>http://www.itk.org/mailman/listinfo/insight-developers



More information about the Insight-developers mailing list