[Insight-developers] itk bugfix

Kent Williams kent at psychiatry.uiowa.edu
Mon Jul 31 16:53:13 EDT 2006


GCC 4 will also enforce using this-> to access object members, though I 
think CMake isn't turning on the 'strict' mode of GCC4 that would 
enforce this.

I remember discussions of this last year, and thought the concensus was 
that we would move towards always fully qualifying member access with 
this->.  This is actually more readable, because it's syntactically 
distinct.  For example

int xyz; // global
class X
{
public:
void blob();
private:
int xyz; // member data
}
void X::blob()
{
    int xyz; // automatic varaible
    xyz = 0;              // addresses auto variable
    this->xyz = 0;     // addresses member data
    ::xyz = 0;            // addresses global
}

Using 'this->' makes it absolutely clear what you're doing, whereas just 
using the member name can potentially confuse a human trying to 
understand the code.

Simon Warfield wrote:

>
> The new Intel compiler version 9.1.042 applies scoping rules correctly 
> but more strictly than before,
> http://www.parashift.com/c++-faq-lite/templates.html#faq-35.18
> , that cause it to not be able to compile the itk_hashtable.h code.
>
> Examples of the error messages are here:
> http://www.itk.org/Testing/Sites/smyslov.bwh.harvard.edu/Linux-x86_64-releaseopt-icc-9.0/20060731-0100-Nightly/BuildError.html 
>
>
> Attached is a corrected version of the file 
> Insight/Code/Common/itk_hashtable.h
>
> I would appreciate it if someone could check it in to the ITK CVS 
> repository.



More information about the Insight-developers mailing list