Код: Выделить всё
Something * MyFunctionThatNeverReturnsNULL() __attribute__((returns_nonnull))
{
// code here that will return a NULL value
static Something blah;
return &blah;
}
[...]
int main()
{
Something * s = MyFunctionThatNeverReturnsNULL();
if (s) // useful: compiler generates a warning here since this test will always return true!
{
// do something
}
else
{
// do something else
}
}
Мой вопрос: есть ли в MSVC что-нибудь подобное/эквивалентное, чтобы при компиляции могли генерироваться предупреждения того же типа? под Windows?
Подробнее здесь: https://stackoverflow.com/questions/787 ... ns-nonnull