// filename:c2011-F-8-4-ex.c // original examples and/or notes: // (c) ISO/IEC JTC1 SC22 WG14 N1570, April 12, 2011 // C2011 F.8.4 Constant expressions // compile and output mechanism: // (c) Ogawa Kiyoshi, kaizen@gifu-u.ac.jp, December.29, 2013 // compile errors and/or wornings: // (c) Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn) // Target: x86_64-apple-darwin11.4.2 //Thread model: posix // (c) LLVM 2003-2009 University of Illinois at Urbana-Champaign. #include // Example #include #pragma STDC FENV_ACCESS ON void f(void) { float w[] = { 0.0/0.0 }; // raises an exception static float x = 0.0/0.0; // does not raise an exception float y = 0.0/0.0; // raises an exception double z = 0.0/0.0; // raises an exception printf("%f %f %f %lf \n",*w,x,y,z); /* ... */ } int main(void) { f(); return printf("F.8.4 Constant expressions\n"); } // warning may be //c2011-F-8-4-ex.c:14:14: warning: pragma STDC FENV_ACCESS ON is not supported, ignoring pragma [-Wunknown-pragmas] //#pragma STDC FENV_ACCESS ON // ^ //1 warning generated. // // output may be //nan nan nan nan //F.8.4 Constant expressions