|
I have personally used two C++ static code analysis tools.
1. Visual Studio. I believe all SKUs of VS 2013 now include code analysis tools though the level of analysis in the Free express edition is not as nice as in the paid versions. Menu is: ANALYZE > Run Code Analysis on Solution.
2. Klocwork. We pay for a Klocwork license [^]. I'm not sure if they have a trial or free version available. A caveat: Klocwork does not handle C++/CLI code however so it skips the /clr files. We have a large body of portable plain C++ code so it works well with that code.
I'm sure there are other tools but C++ code analysis is difficult and most are expensive commercial tools.
John
|
|
|
|
|
http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis[^]
Most of the tools are commercial, but if it is your job, and you find that one of the commercial tools will notably improve the quality or speed of your work, you shouldn't have any problems convincing your boss to buy a license. The free ones I've tried are rather limited in scope and capabilities.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
When I read about delegate , I can figure out what that is and when we use that. But when I read about event , I mix things up and cannot find out how to understand the real difference and exact use of that in my codes. Every time I read about event , it gets more blur in my mind! Can you please explain that in a simple way? Thanks
|
|
|
|
|
A delegate is like a function pointer, and event is like a function.
When an event is raised, it calls each delegate that is attached to it.
Events are generic in that they can accept delegates that point to any function, as long as the delegates ' signatures match the signature of the event .
Events are points of attachment for delegates to receive calls from an object.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I know a little in C++ world by reading some basic parts of C++ Primer book and doing simple stuff by C++. I'm about in the middle of the Microsoft Visual C++/CLI Step by Step and trying to reach a middle level in C++, the language I love. I like to write Windows apps including the traditional way and also Windows store. Do you have any advice or recommendation to me as an improvement, getting much better or so? Thanks guys
|
|
|
|
|
|
As Richard indicates, nothing beats actually writing some code and learning by doing.
There is one book I really like which isn't on the reference page:
"C++/CLI In Action" by Nishant Sivakumar.
|
|
|
|
|
Hi all,
I want to use MD5 to hash message. I see some implementation in the internet but my problem is that my message is not a string but a packet type. Someone can help please?
regards
|
|
|
|
|
Hashing works on bytes, whether they are characters or not is not important.
Veni, vidi, abiit domum
|
|
|
|
|
Well, type of data is not important.
Anyhow you have to send data to MD5 with array so there is no important thing happened when you send char array or byte array.
The difference between your message and string is that use byte array or use char array.
So, you can send byte array which implements your message contents to HD5 instead of char array. That's all.
|
|
|
|
|
#include <stdio.h>
#include<string.h>
char f[10000];
char factorial[1010][10000];
void multiply(int k)
{
int cin,sum,i;
int len = strlen(f);
cin=0;
i=0;
while(i<len)
{
sum=cin+(f[i] - '0') * k;
f[i] = (sum % 10) + '0';
i++;
cin = sum/10;
}
while(cin>0)
{
f[i++] = (cin%10) + '0';
cin/=10;
}
f[i]='\0';
for(int j=0;j<i;j++)
factorial[k][j]=f[j];
factorial[k][i]='\0';
}
void fac()
{
int k;
strcpy(f,"1");
for(k=2;k<=1000;k++)
multiply(k);
}
void print(int n)
{
int i;
int len = strlen(factorial[n]);
printf("%d!\n",n);
for(i=len-1;i>=0;i--)
printf("%c",factorial[n][i]);
printf("\n");
}
int main()
{
int n;
factorial[0][0]='1';
factorial[1][0]='1';
fac();
while(scanf("%d",&n)==1){
print(1);
}
return 0;
}
|
|
|
|
|
And??
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
??
What do you want?
|
|
|
|
|
Beside the fact that no question is asked, there is no CLI in the code; this is all standard C++. I believe this is posted to the wrong forum.
|
|
|
|
|
what is the code all about? Please ask question what do you want.
I love to answer c++ question :P
|
|
|
|
|
Testing started ...
Check for sensible topic name .................. failed!
Check comprehensibility of the question ........ check aborted; missing data!
Check for code example ......................... success!
Check for code readability and documentation ... failed!
Check topic against sub forum type ............. failed!
Test completed.
Test results:
1 success
3 failed
1 aborted
We are sorry to inform you that at this moment there is insufficient data to process your query.
Thank you for using CodeProject Forums.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
when I debug my app within a break ,"Internal error: pc 0x112 in read in psymtab, but not in symtab"jump out. what's up to my app?
|
|
|
|
|
Looks like you have the wrong forum for this question.
You may get a better response from qtforum.org or stackoverflow.com.
John
|
|
|
|
|
|
Have you got an answer on your question about crash?
I'm having a similar problem and don't know why...
|
|
|
|
|
int _tmain() {
LPCTSTR strName("HideDriver.sys");
utils::DriverWork::Start(strName);
return 0;
}
/*this code causes error LNK2019: unresolved external symbol "public: static void __cdecl utils::DriverWork::Start(char const *)" (?Start@DriverWork@utils@@SAXPBD@Z) referenced in function _main */
it builds fine by including DriverWork.cpp but does not build by only including DriverWork.h,,,,???
|
|
|
|
|
af00001 wrote: it builds fine by including DriverWork.cpp but does not build by only including DriverWork.h,,,,??? The .h files do not get actioned by the build system or compiler, only insofar as they are included into the source via the .cpp files. The compiler will only get executed to convert a .cpp file (and its inclusions) into object code.
Veni, vidi, abiit domum
|
|
|
|
|
|
This looks more like unmanaged C++ than managed. You need to include the .lib file of the dll the function resides in into the linker input of your application.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
Freak30 wrote: This looks more like unmanaged C++ than managed. Not at all. The key is that the code is contained within the header file, so why is the .cpp file necessary. That's the way C++/CLI is done.
Veni, vidi, abiit domum
|
|
|
|