CppCheck и обнаружение утечек.
От: dr. Acula Украина  
Дата: 14.07.15 14:03
Оценка: 17 (3) -2
Просто для справки тем, кто подумает использовать сие поделие для статического анализа.
Stack Overflow


AbstractTelegram *TelegramFactory::CreateGetWigWagParameterTelegram(BYTE     Address_i, BYTE SubAddress_i, BYTE Tag_i)
{
   SignDataWigWag *pWigWag = new SignDataWigWag();

   return new SendTelegram(SubAddress_i, Tag_i, Telegram::GET_WIG_WAG,NULL,0);
}


Комментарии из IRC с разработчиками.

[13:04] <danmar> I assume you mean that "pWigWag" should be deleted?
[13:04] <danmar> I will write a reply in the stackoverflow..
[13:05] <danmar> but quick story.. there are classes that has automatic memory management.
[13:08] <blackhearted_> yes
[13:08] <blackhearted_> i mean pWigWag.
[13:08] <blackhearted_> automatic memory management? what does it mean in the context of question on SO?
[13:11] <blackhearted_> class has only POD members
[13:14] <danmar> I posted my answer..
[13:14] <blackhearted_> cool, thanks!
[13:15] <danmar> .. so we need to analyse the constructor to see if there is a memory leak.
[13:16] <blackhearted_> but you do not do this at the moment?
[13:16] <danmar> I believe we have some simple analysis..
[13:17] <danmar> if the class doesn't have a constructor and doesn't inherit then we warn as far as I know..
[13:17] <danmar> if there is a constructor and we can see it ... I don't know when we warn..
[13:18] <blackhearted_> okay, understood, thanks for the clarification and support!
[13:19] <danmar> we used to have an option so you could define that SignDataWigWag does not have automatic memory management.. and then there would be warnings..
[13:19] <danmar> but as far as I know there is no such option now.


Фейспалм, что еще сказать.
Как после такого можно писать :

Features

Out of bounds checking
Memory leaks checking
Detect possible null pointer dereferences
Check for uninitialized variables
Check for invalid usage of STL
Checking exception safety
Warn if obsolete or unsafe functions are used
Warn about unused or redundant code
Detect various suspicious code indicating bugs


я не понимаю.

Зато опенсорс, да.
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.