I have the following code:
if (destIndex < destLen && srcIndex < srcLen)
dest[destIndex++] = src[srcIndex++];
This code runs fine.
If I remove the if, then the code crashes.
If I then run the following code
if (destIndex < destLen && srcIndex < srcLen)
dest[destIndex++] = src[srcIndex++];
else
fprintf(stderr, "Buffer Overrun\n");
Then I never get the print out "Buffer Overrun"
SO, how to debug this?
The seg fault only happens with optimizations turned on (no debug mode)
Aucun commentaire:
Enregistrer un commentaire