Skip to content

Instantly share code, notes, and snippets.

@nasitra
Created January 18, 2016 10:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nasitra/500c248e945e73bc6714 to your computer and use it in GitHub Desktop.
Save nasitra/500c248e945e73bc6714 to your computer and use it in GitHub Desktop.
Inconsistent result from assignment the negative double value to an enum-type variable
#include <stdio.h>
typedef enum {
ZERO
} NUM;
int main(void) {
double a = -1.0;
NUM b = a;
printf("%d %d\n", b == ZERO, b != ZERO); // same result !?
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment