I have the following code (called misc.c)
#include <stdlib.h> #include <stdio.h> #include <mkl.h> #include <math.h> // double my_value = 1.0f; // Works fine. double my_value = NAN; // Gives "error: expression must have a constant value". int main () { // double my_value = NAN; // Works fine. printf("my value is %f\n", my_value); return 0; }
However, when I try to compile this using ICC (18.0.0 20170811) I get the following error:
% icc -mkl -D__PURE_INTEL_C99_HEADERS__ misc.c -o misc misc.c(6): error: expression must have a constant value double my_nan = NAN;
However, if I use GCC this works fine (after commenting out the mkl.h include line) and runs as expected.
I find this a bit strange and unexpected. Should I have expected this?