i Windows 7'nin yeni bir kopyasını ve Visual Studio 2010 Premium SP1 yüklerseniz, bir sihirbaz tarafından oluşturulan "C++ konsol uygulaması" oluşturmak ve .cpp
dosyaya 3 başlıklarını ekleyin:Visual Studio 2010'da C++ için "kod çözümlemesi" doğru şekilde nasıl kullanılır?
#include <winsock2.h>
#include <WS2tcpip.h>
#include <wspiapi.h>
"Run Kod Analizi" çalıştırılıyor bana Microsoft kodunda uyarıları (proje kendisi sihirbaz tarafından oluşturulan bu yüzden hiç hata) gösterecektir:
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2tcpip.h(729): warning C6386: Buffer overrun: accessing 'argument 1', the writable size is '1*4' bytes, but '4294967272' bytes might be written: Lines: 703, 704, 705, 707, 713, 714, 715, 720, 721, 722, 724, 727, 728, 729
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\wspiapi.h(294): warning C6386: Buffer overrun: accessing 'argument 1', the writable size is '1' bytes, but '1025' bytes might be written: Lines: 263, 264, 265, 267, 268, 270, 271, 273, 294
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\wspiapi.h(236): warning C6387: '*pptResult' might be '0': this does not adhere to the specification for the function 'WspiapiQueryDNS': Lines: 263, 264, 265, 267, 268, 270, 271, 273, 294, 296
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\wspiapi.h(687): warning C6387: 'argument 1' might be '0': this does not adhere to the specification for the function 'WspiapiLegacyFreeAddrInfo': Lines: 504, 505, 506, 507, 508, 509, 510, 512, 513, 514, 515, 516, 520, 528, 532, 538, 550, 551, 555, 556, 560, 563, 568, 575, 577, 578, 589, 591, 592, 593, 596, 598, 599, 600, 604, 607, 610, 611, 627, 662, 664, 680, 685, 687
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\wspiapi.h(481): warning C6387: '*pptResult' might be '0': this does not adhere to the specification for the function 'WspiapiLegacyGetAddrInfo': Lines: 504, 505, 506, 507, 508, 509, 510, 512, 513, 514, 515, 516, 520, 528, 532, 538, 550, 551, 555, 556, 560, 563, 568, 575, 577, 578, 589, 591, 592, 593, 596, 598, 599, 600, 604, 607, 610, 611, 627, 662, 664, 680, 685, 687, 688, 691
Bu büyük projeler için kod analizi kullanılamaz yapar - ben Microsoft başlık dosyalarında uyarılar binlerce almak ve ben yapamam aralarında kendi uyarılarımı bulmak :(Microsoft üstbilgisini hariç tutmanın bir yolu var mı s/SDK kod analizinden bu şekilde kullanılabilir hale gelecek?
P.S. C++ 'nın Visual Studio için iyi desteklenen bir dil olmadığını biliyorum, ancak destek ve geliştirmem gereken mevcut projelerden dolayı dili değiştiremiyorum :(.
teşekkür ederiz, bu tamamen çözülmüş benim sorunum^_^ – grigoryvp
Bu çok kullanışlıdır. Teşekkürler. Doğru olmayan bir windows işlevinden uyarı alıyorum. Uyarı, # 3 parametresi olarak 0 belirtemediğimi söyledi, ancak msdn'de bunu yapabileceğimi söylüyor. – James