On 10/04/12 02:08, Alex Malyushytskyy wrote: > And I still do not see a reason to prefer Q_ASSERT over Q_CHECK_PTR > when checking pointers for NULL, even though I would change the > default message it prints to mention "NULL pointer" instead of "out of > memory".
That's the reason. I expect Q_CHECK_PTR's error message is not going to change, so in my opinion it's better to get 'ASSERT: "foo"' than "out of memory". But if you're accustomed to Q_CHECK_PTR and don't like Q_ASSERT for some reason, just use whatever fits your needs better. > at least on Windows you might get not NULL pointer as a result of > memory allocation even if process is out of memory and only attempt > to use it will have result in exception thrown. A typical behavior of Linux is similar; by default, you have memory overcommit enabled which means that allocation returns a valid pointer but further access will likely result in a SIGSEGV. With kind regards, Jan -- Trojita, a fast e-mail client -- http://trojita.flaska.net/ _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest