|
-
Oct 10th, 2006, 01:19 PM
#1
Thread Starter
yay gay
Is MS C++ 7.0 ANSI compliant?
Is it? I'm starting my c (and later c++) classes right now and I have been using C# in the last years so I love Visual Studio and I'd love to be able to do my c/c++ programs there but I've heard MS C/c++ it is not ANSI compliant.
So..is it or not? My teacher says it is not but i thinnk he was talking about vc++ 6 or something along the lines
\m/  \m/
-
Oct 10th, 2006, 01:54 PM
#2
Re: Is MS C++ 7.0 ANSI compliant?
 Originally Posted by PT Exorcist
Is it? I'm starting my c (and later c++) classes right now and I have been using C# in the last years so I love Visual Studio and I'd love to be able to do my c/c++ programs there but I've heard MS C/c++ it is not ANSI compliant.
So..is it or not? My teacher says it is not but i thinnk he was talking about vc++ 6 or something along the lines
The microsoft C compiler is not compliant to the C (99) standard -- I think it's still stuck around C '89. For example, you must declare all variables at the beginning of a function using MS's compiler, while the 99 standard says this is not required.
The C++ compiler is much more standards compliant, but how much depends on whether you're talking about the version that comes with .NET 2003, .NET 2005, etc. I would wager that any of the C++ compilers can handle what you'll be doing in the class; the C compiler might not.
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
-
Oct 10th, 2006, 02:40 PM
#3
Re: Is MS C++ 7.0 ANSI compliant?
VC++ differs with GCC in where variables are declared.
In GCC you are allowed to declare a variable anywhere in a function, but for some reason when compiling with the "Compile to C Code" switch VC complains and makes you move all variable declarations to the top of the function.
I'm not sure what the ANSI standard has to say about this. It's onl 550 pages long so I should find something in there
Last edited by wossname; Oct 10th, 2006 at 02:52 PM.
I don't live here any more.
-
Oct 10th, 2006, 03:54 PM
#4
Re: Is MS C++ 7.0 ANSI compliant?
C89 only allows declarations at the top of functions. VC is pretty much compliant with respect to C. I doubt the C++ compiler is 100% standards compliant, because C++ is incredibly hard to get right (and whether 'right' is what you want is debatable), but it is close enough (starting with 7.0).
By default GCC enables several extensions (such as allowing variable declarations everywhere), use the -ansi flag to switch to standard compliant mode.
-
Oct 10th, 2006, 05:54 PM
#5
Re: Is MS C++ 7.0 ANSI compliant?
 Originally Posted by twanvl
C89 only allows declarations at the top of functions. VC is pretty much compliant with respect to C. I doubt the C++ compiler is 100% standards compliant, because C++ is incredibly hard to get right (and whether 'right' is what you want is debatable), but it is close enough (starting with 7.0).
By default GCC enables several extensions (such as allowing variable declarations everywhere), use the -ansi flag to switch to standard compliant mode.
C89 only allows declarations at the top of functions, but C99 allows you to declare them everywhere. In this respect, VC is compliant, but to an outdated standard.
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
-
Oct 10th, 2006, 07:54 PM
#6
Re: Is MS C++ 7.0 ANSI compliant?
There exists no 100% compliant C++ compiler today. So much for that.
However, VC++ is, since version 7.1 (Visual Studio.Net 2003) pretty compliant, and even more compliant since version 8.0 (VS.Net 2005), although a lot of stupid stuff has been added in that most recent version too.
Version 7.0 (VS.Net 2002) is hardly an improvement over the very poorly compliant version 6.5 (VC++6, Service Pack 6). VC++6 itself is a desaster, although it has an excuse: it was published a few months before the C++ standard itself.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Oct 11th, 2006, 02:44 PM
#7
Thread Starter
yay gay
Re: Is MS C++ 7.0 ANSI compliant?
and about writting pure C code? will I have any kind of problems or nowadays all C compilers are ansi compliant?
\m/  \m/
-
Oct 11th, 2006, 02:57 PM
#8
Re: Is MS C++ 7.0 ANSI compliant?
Well I'm trying to write pure C code in linux. GCC is working fine, but if I turn on ANSI compliance mode it gives me a load of errors I cannot understand, so I don't. Also VC++ seems to be OK too. I've written a simple DLL in VC++ (using the ANSI C switch so it doesn't compile to C++) and its fairly decent. I used it from within a C# app with no problem at all.
I think that trying to conform ABSOLUTELY to the ANSI C standard is very hard to do and probably not worth the effort. GCC is good enough fo me and compiles small and fast binaries.
I don't live here any more.
-
Oct 11th, 2006, 03:38 PM
#9
Re: Is MS C++ 7.0 ANSI compliant?
 Originally Posted by wossname
I think that trying to conform ABSOLUTELY to the ANSI C standard is very hard to do
I wouldn't know why. The C standard isn't that complex. It's mostly a matter of style.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|