The following example:const static volatile double zero = 0.0;#define EXP(E) printf("%s == %u\n", #E, E)int main(int argc, char **argv) { EXP(zero ? 1 : 0); EXP(-zero ? 1 : 0); EXP(0.0 ? 1 : 0); EXP(-0.0 ? 1 : 0); return EXIT_SUCCESS;}Should print the following result:zero ? 1 : 0 == 0-zero ? 1 : 0 == 00.0 ? 1 : 0 == 0-0.0 ? 1 : 0 == 0However, the last two lines shows "1" using Visual C++ 2010 (cl.exe 16.00.30319.01 for x64 or x86)The same behavior is seen in the latest release, too, according to David Lowndes (*)It was said (comp.lang.c) that according to the C standard, it should be 0 (3.3.15, "Conditional operator")(*) See http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/8caf1a5a-d421-4a92-b924-468327afaec3
Visual Studio/Team Foundation Server/.NET Framework Tooling Version
What category (if any) best represents this feedback?
Steps to reproduce
Product Language
Operating System
Operating System Language
Actual results
Expected results
Locale
Please wait...