Which of these methods is more secure for defining variable types? I know that we all frown when we see #defines, but it seems to work just as well as typedef here:
Is there an advantage one way or the other, and if so what might it be?
Method One:
#include <iostream>
#define byte unsigned char
int main() {
byte testByte = 'A';
std::cout << testByte << std::endl;
return 0;
}
Method Two:
#include <iostream>
int main() {
typedef unsigned char byte;
byte testByte = 'A';
std::cout << testByte << std::endl;
return 0;
}