SergeyBel/AES

Compilation warning "comparison of integer expressions of different signedness"

BullyWiiPlaza opened this issue · 3 comments

The following code produces a warning about comparing integer expressions of different signedness:

void AES::printHexArray(unsigned char a[], unsigned int n) {
	for (int i = 0; i < n; i++) { // <--
		printf("%02x ", a[i]);
	}
}

The fix is to simply declare i as an unsigned int.

What command do you use to compile?

I use GCC with the command line flags -Wall and -Wextra which enable more warnings than you get by default.

Fixed in #30