1

I created a Win32 Console project (disabled "precompiled header" option) with my VS2010.

Then I filled the code as below

#include <stdio.h>
int main (void) {
    double d = 0x0.3p10;
    printf ("%.f\n", d);
    return 0;
}

The compiler shows a syntax error on the line of double d = 0x0.3p10;.

: error C2059: syntax error : 'bad suffix on number'
: error C2143: syntax error : missing ';' before 'constant'
: error C2146: syntax error : missing ';' before identifier 'p10'
: error C2065: 'p10' : undeclared identifier

Is there something wrong on my project configuration?

templatetypedef
  • 362,284
  • 104
  • 897
  • 1,065
Nano HE
  • 9,109
  • 31
  • 97
  • 137

1 Answers1

3

No. Microsoft Visual C++ doesn't support ISO C99. Sorry. There is no workaround except to use a different compiler. See this question's accepted answer.

Alternatives:

  1. Clang which will work with the MSVC headers. I don't think there are binaries available for it yet though so unless you like compiling compilers...
  2. mingw which comes with msys and a complete set of headers of its own for the w32api.
  3. Intel's Compiler Suite. This integrates with Visual Studio but is non-free.
Community
  • 1
  • 1
  • I am reading a c language book based on C99. Then what C compiler be recommended on winxp os. thank you. – Nano HE Jan 28 '11 at 08:04
  • 1
    Put some alternatives into the answer for you. `mingw` is probably the easiest to get going with; it's `gcc` for Windows basically and very good. –  Jan 28 '11 at 08:09