On Fri, Feb 19, 2016 at 01:44:45PM +0100, Petr Spacek wrote: > > It's about checking whether "this", in C++, is NULL. Since any call on a > > null > > pointer is undefined behavior, any code relying on such checks is > > non-standard. > > Ah, okay. I was talking about pure C all the time, so I got confused :-)
It is not really different for C, just that "this" is in C++ implicitly nonnull. Otherwise, if you use a nonnull attribute, you make the same promise, this function will never be called with NULL as some particular pointer argument (or all pointer arguments). So, the undefined behavior happens if you violate that and call a function with an invalid argument. Jakub -- devel mailing list devel@lists.fedoraproject.org http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org