a class function with if(this==NULL) test got compiled?
- by James
I saw this code snippet during our lab and it actually compiles in MSVC2008 and G++.
void LinkList< class T ::Insert(T n)
{
if (this == NULL)
// some code here
}
As far as I know the this must not be null since you cannot call a class functions in c++ if it wasn't instantiated. Is this a valid code? if so what's the reason behind and where it can be useful?