troubleshooting Question

Having C code checksum itself

Avatar of steva
steva asked on
C
9 Comments3 Solutions239 ViewsLast Modified:
I'd like to have my C code run a checksum on itself to detect any tampering. I thought I could do something like:

StartLabel:
      --- code---
EndLabel:

UINT *p;
UINT checksum=0;
for(p=StartLabel; p<EndLabel; p++)
      checksum^=*p;

But the compiler kicks out the " p=StartLabel" with an "undeclared identifier" , though a "goto StartLabel;" compiles fine.

Does anyone see the problem here, or have a way to do this?

Thanks
steva
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 3 Answers and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros