तो मैं विंडोज 7 की ताज़ा प्रति और विजुअल स्टूडियो 2010 प्रीमियम SP1 स्थापित करते हैं, एक जादूगर-निर्मित "सी ++ सांत्वना आवेदन" बना सकते हैं और .cpp
फाइल करने के लिए 3 हेडर जोड़ें:सी ++ के लिए विजुअल स्टूडियो 2010 में "कोड विश्लेषण" का सही तरीके से उपयोग कैसे करें?
#include <winsock2.h>
#include <WS2tcpip.h>
#include <wspiapi.h>
निष्पादित "रन कोड विश्लेषण" मुझे माइक्रोसॉफ्ट कोड में चेतावनी (परियोजना ही है, जादूगर-उत्पन्न है, तो कोई त्रुटि) दिखाएगा:
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
इस कोड विश्लेषण बड़ा परियोजनाओं के लिए बेकार बना देता है - मैं माइक्रोसॉफ्ट हेडर फाइल में चेतावनी के हजारों मिलता है और मैं नहीं कर सकता उनके बीच अपनी चेतावनियां पाएं :(। क्या यह माइक्रोसॉफ्ट हेडर को बाहर करने का कोई तरीका है कोड विश्लेषण से एस/एसडीके तो यह उपयोग करने योग्य बन जाएगा?
पीएस मुझे पता है कि सी ++ विजुअल स्टूडियो के लिए एक अच्छी तरह से समर्थित भाषा नहीं है, लेकिन मैं मौजूदा परियोजनाओं के कारण भाषा को नहीं बदल सकता, मुझे समर्थन और सुधार करने की आवश्यकता है :(
धन्यवाद, यह पूरी तरह से हल^_ ^? – grigoryvp
यह बहुत उपयोगी था। धन्यवाद। मुझे विंडोज़ फ़ंक्शन से चेतावनी मिल रही थी जो सही नहीं था। चेतावनी ने कहा कि मैं # 3 पैरामीटर के रूप में 0 निर्दिष्ट नहीं कर सका, लेकिन एमएसडीएन में कहता है कि मैं ऐसा कर सकता हूं। – James