A
albert.neu
To what extent does
Microsoft Visual C++
also called: VC++
also called: Microsoft (R) 32-bit C/C++ Optimizing Compiler
support C99?
VC++ compiles either in C mode (which is def. *not* C99!):
cl.exe /TC c_file.c
or in C++ mode
cl.exe /TP cpp_file.cpp
In C mode (/TC), VC++ is definately *not* conform to C99!
But an interesing question is:
How conform is VC++ to C99, when used in C++ mode (/TP)??
This is particularly interesting, when considering that
the C99 library is part of C++ TR1.
http://groups.google.at/group/comp....6ecb1/95879cd6fca0acc8?hl=en#95879cd6fca0acc8
To what extent does the latest VC++ (in C++ mode /TP) support C++ TR1?
To what extent does the latest VC++ (in C++ mode /TP) use Dinkumware
libraries?
The following is valid C99 code:
/************* c_test.c ***************/
#include <stdio.h>
#include <stdbool.h>
#include <limits.h>
int main( void )
{
bool b = true;
if (b)
printf("hello world\n");
char c = 5;
printf("%hhd\n", c);
int size = INT_MAX / 10000;
printf("%d\n", size);
char a[size];
a[0] = 'a';
a[1] = 'b';
a[2] = '\0';
printf("%s\n", (char *)&a);
return 0;
}
The above C99 code can be compiled on VC++, by just commenting the 2nd
line (see below!)
/************* cpp_test.cpp ***************/
#include <stdio.h>
//#include <stdbool.h>
#include <limits.h>
int main( void )
{
bool b = true;
if (b)
printf("hello world\n");
char c = 5;
printf("%hhd\n", c);
const int size = INT_MAX / 10000;
printf("%d\n", size);
char a[size];
a[0] = 'a';
a[1] = 'b';
a[2] = '\0';
printf("%s\n", (char *)&a);
return 0;
}
To compile with VC++:
cl.exe \TP cpp_test.cpp
Works perfectly! Hmmm... almost C99...???
Comments appreciated,
Albert
Note:
Microsoft VC++ compiler can be obtained for free:
"Visual C++": Microsoft (R) 32-bit C/C++ Optimizing Compiler"
Search
http://www.microsoft.com/downloads
for
"Microsoft Windows SDK for Windows Vista"
On download page; check the "System Requirements":
e.g.
Windows XP Professional SP2 (OK!), Windows Vista, etc.
(Otherwise search for another compatible "Microsoft Windows SDK")
After installing:
The batch-skript for environment variables can be envoked as follows
"C:\Program Files\Microsoft SDKs\Windows\v6.0\bin\setenv.cmd" /
Release /x86 /xp
In setenv.cmd:
'color 07' is normal white on black
Compiler is here:
C:\Programme\Microsoft SDKs\Windows\v6.0\VC\Bin\cl.exe
Microsoft Visual C++
also called: VC++
also called: Microsoft (R) 32-bit C/C++ Optimizing Compiler
support C99?
VC++ compiles either in C mode (which is def. *not* C99!):
cl.exe /TC c_file.c
or in C++ mode
cl.exe /TP cpp_file.cpp
In C mode (/TC), VC++ is definately *not* conform to C99!
But an interesing question is:
How conform is VC++ to C99, when used in C++ mode (/TP)??
This is particularly interesting, when considering that
the C99 library is part of C++ TR1.
http://groups.google.at/group/comp....6ecb1/95879cd6fca0acc8?hl=en#95879cd6fca0acc8
To what extent does the latest VC++ (in C++ mode /TP) support C++ TR1?
To what extent does the latest VC++ (in C++ mode /TP) use Dinkumware
libraries?
The following is valid C99 code:
/************* c_test.c ***************/
#include <stdio.h>
#include <stdbool.h>
#include <limits.h>
int main( void )
{
bool b = true;
if (b)
printf("hello world\n");
char c = 5;
printf("%hhd\n", c);
int size = INT_MAX / 10000;
printf("%d\n", size);
char a[size];
a[0] = 'a';
a[1] = 'b';
a[2] = '\0';
printf("%s\n", (char *)&a);
return 0;
}
The above C99 code can be compiled on VC++, by just commenting the 2nd
line (see below!)
/************* cpp_test.cpp ***************/
#include <stdio.h>
//#include <stdbool.h>
#include <limits.h>
int main( void )
{
bool b = true;
if (b)
printf("hello world\n");
char c = 5;
printf("%hhd\n", c);
const int size = INT_MAX / 10000;
printf("%d\n", size);
char a[size];
a[0] = 'a';
a[1] = 'b';
a[2] = '\0';
printf("%s\n", (char *)&a);
return 0;
}
To compile with VC++:
cl.exe \TP cpp_test.cpp
Works perfectly! Hmmm... almost C99...???
Comments appreciated,
Albert
Note:
Microsoft VC++ compiler can be obtained for free:
"Visual C++": Microsoft (R) 32-bit C/C++ Optimizing Compiler"
Search
http://www.microsoft.com/downloads
for
"Microsoft Windows SDK for Windows Vista"
On download page; check the "System Requirements":
e.g.
Windows XP Professional SP2 (OK!), Windows Vista, etc.
(Otherwise search for another compatible "Microsoft Windows SDK")
After installing:
The batch-skript for environment variables can be envoked as follows
"C:\Program Files\Microsoft SDKs\Windows\v6.0\bin\setenv.cmd" /
Release /x86 /xp
In setenv.cmd:
'color 07' is normal white on black
Compiler is here:
C:\Programme\Microsoft SDKs\Windows\v6.0\VC\Bin\cl.exe