Hi,
I wanted to use (x->isNull()) to find out, if I can safely use a pointer to something. However, if I use it like this:
Qt Code:
  1. SomeType *x;
  2. //doing some work, perhaps giving x a new object to point to, perhaps not
  3. if (x->isNull()) return false;
To copy to clipboard, switch view to plain text mode 
the program crashes on the if-condition. I can see why: there is no object to get the ->isNull() method from.

If I use:
Qt Code:
  1. if (x==0) return false;
To copy to clipboard, switch view to plain text mode 
instead, it works.

Now I have three curious questions:
  1. Is it "legal" (aka: advisable) to use the second approach?
  2. Will *-Declarations ensure that the Variable points to 0 before it gets an object to point to?
  3. Is there any use for ->isNull()?