473,382 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Visual C++ support of C99 by using "C++ mode" (/TP)

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.l...879cd6fca0acc8

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

Mar 31 '07 #1
10 13361
al********@gmail.com wrote:
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!)
In other words, by making it valid C++ and invalid C99.

What's your point?

Mar 31 '07 #2
al********@gmail.com said:
To what extent does
Microsoft Visual C++
also called: VC++
also called: Microsoft (R) 32-bit C/C++ Optimizing Compiler

support C99?
Because Visual C supports C90, it has de facto support for most of C99
(because most of C99 is basically C90), but it makes no claims of C99
conformance. Neither has Microsoft expressed the slightest interest in
supporting C99 until a significant proportion of their customers
requires it (which doesn't seem to be about to happen any time soon).

<snip>

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Mar 31 '07 #3
On Mar 31, 1:20 pm, "Harald van Dijk" <true...@gmail.comwrote:
albert....@gmail.com wrote:
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!)

In other words, by making it valid C++ and invalid C99.

What's your point?
My point is:
Maby the difference between VC++ in C++ mode and C99 is marginal.
(In the example above, only the header is not known in the current VC+
+ (but bool is supported anyway))

And maby this difference will get even smaller, if VC++ adopts (or
conforms more closely to) newer C++ standards.

Albert

Mar 31 '07 #4

<al********@gmail.comwrote in message
news:11********************@e65g2000hsc.googlegrou ps.com...
In other words, by making it valid C++ and invalid C99.

What's your point?
My point is:
Maby the difference between VC++ in C++ mode and C99 is marginal.
No it's huge, even in this case where you use bool you will have to remove
stdbool.h references because VC++ doesnt supply the header. Thats not
C99....and theres way more C99 features that wont work no matter how you try
to run the compiler.

try and compile code like this:
struct S s = { .X = 2, .Y = 3, .Z = 4 };

Mar 31 '07 #5
try and compile code like this:
struct S s = { .X = 2, .Y = 3, .Z = 4 };
This does not even compile with EDG/C99.
Try it here
http://www.dinkumware.com/exam/
(Is any header required??)

Mar 31 '07 #6
'just relized that perhaps c_test.c
http://groups.google.at/group/comp.l...1a8816e8e87e3e
is not valid C99 after all!

c_test.c only compiles with EDG/C99 (http://www.dinkumware.com/exam/),
if line 14 looks like this
int size = INT_MAX / 10000;

Mar 31 '07 #7
On Mar 31, 2:06 pm, albert....@gmail.com wrote:
c_test.c only compiles with EDG/C99 (http://www.dinkumware.com/exam/),
if line 14 looks like this
int size = INT_MAX / 10000;
sorry (above post has an error);
I meant like this:
const int size = INT_MAX / 10000;

Mar 31 '07 #8

<al********@gmail.comwrote in message
news:11*********************@q75g2000hsh.googlegro ups.com...
>try and compile code like this:
struct S s = { .X = 2, .Y = 3, .Z = 4 };

This does not even compile with EDG/C99.
Try it here
http://www.dinkumware.com/exam/
(Is any header required??)
It's valid C99 nonetheless
Mar 31 '07 #9
<al********@gmail.comwrote in message
news:11**********************@n76g2000hsh.googlegr oups.com...
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.l...879cd6fca0acc8

To what extent does the latest VC++ (in C++ mode /TP) support C++ TR1?
Not at all.
To what extent does the latest VC++ (in C++ mode /TP) use Dinkumware
libraries?
We supply the Standard C++ library only, and have done so for over a
decade. But it is our earnest desire to license everything we have
to Microsoft, sooner or later. Note that the next revision of Standard
C++ will include all of the C99 library, as well as most of the rest
of TR1. To the extent that this creates demand from the public,
Microsoft might be interested in adding these features.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
>

Mar 31 '07 #10

"P.J. Plauger" <pj*@dinkumware.comwrote in message
news:-M******************************@giganews.com...
>>
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.l...879cd6fca0acc8

To what extent does the latest VC++ (in C++ mode /TP) support C++ TR1?

Not at all.
>To what extent does the latest VC++ (in C++ mode /TP) use Dinkumware
libraries?

We supply the Standard C++ library only, and have done so for over a
decade. But it is our earnest desire to license everything we have
to Microsoft, sooner or later. Note that the next revision of Standard
C++ will include all of the C99 library, as well as most of the rest
of TR1. To the extent that this creates demand from the public,
Microsoft might be interested in adding these features.
If MS does, it might be that little push that C99 needs to be commonly
accepted. Personally I would love to see MSVC with full C99 support.
Mar 31 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tinku | last post by:
Hi All We are migrating one of our application from Informix to Oracle. Now one of our tables contains a column named "MODE" which is a reserved word. I could create the table with this name...
1
by: Seth Guard | last post by:
(Sorry for the cross-post, but no one responded to my other thread.) When developing a web page in VS.Net, I see everything in WYSIWYG format. And when I am creating a User Control, I see that...
2
by: Dave Reid | last post by:
Hi everyone... I'm trying to open a text file in exclusive mode (meaning I want to lock out any other processes from accessing the file while I'm working with it). Here's my code: ifstream...
4
by: timmy | last post by:
I have a table with a cell on the bottom right with an image to create a rounded corner effect: <table cellpadding="0" cellspacing="0" border="1"> <tr><td rowspan="2">asdfsadf</td> <td...
0
by: YFS DBA | last post by:
I'm getting an error message when I open queries then try to close them: "This action will reset the current code in break mode" Clicking on 'Yes' just brings up the same message. If I change...
14
by: MuZZy | last post by:
Hi, Lately i've been (and still am) fixing some memory leaks problems in the project i just took over when i got this new job. Among the other issues i've noticed that for localy created objects...
11
by: Tolga | last post by:
After a very rapid entrance into the Python, I have immediately looked for a good IDE. Komodo and Wing IDE look very good and I think they are enough. But now, I am searching for a Pyhton...
1
by: Heather | last post by:
I keep selecting and selecting, but it just doesn't show up. I also have no button in the ribbon for this, or any ability to get into other modes via the Office button. It's very frustrating; I had...
3
by: Moe Sisko | last post by:
Using dotnet 2.0 sp1, I've got ASP.NET session state working ok in SQLServer mode, but the sessions never seem to expire. e.g if I add a timeout attribute like so : <sessionState...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.