In my application i want to represent AND as 1 , and OR as 0, instead of opting for #define
method , i am using enum to represent them , as shown in the below example program
#include <stdio.h>
enum gateConnection_t
{AND,OR}
gateConnection;
int main()
{
bool and_t = AND;
bool or_t = OR;
printf("%d\n",and_t);
printf("%d\n",or_t);
return 0;
}
As seen above , i am directly assigning the enum values to boolean vvariables. The program works as expected and my only question is whether the internal cast done is safe , or is it better to use explicit casting such as static_cast
?