are there c++ updates?

Started by
25 comments, last by wolfbane 20 years, 1 month ago
I just started c++ but have been doing Java for a while now. I was wondering if there are updated versions of c++ that have to be downloaded, like with Java. I am using Visual C++ 6. I am asking bcasue when I needed help creating a sting I found 2 solutions. One is to use a char string[10], while the other was to #include <string> and then just declare a string. Obviously I got the first way to work, but not the second.
Advertisement
The newest C++ standard is 5 years old. But your compiler isn't even compliant to that. You should upgrade to Visual Studio .NET 2003 (version 7.1)

char string[10] is in fact not a string, but an array of bytes.

std::string from is an object, that resembles the function of a native string in other languages.

You can't compare them directly.

This should work:

#include <string>#include <iostream>int main(){  std::string string("Hello, World!");  std::cout << string << std::endl;} 


[edited by - noVum on March 5, 2004 5:24:11 PM]
There are several answers to this question:

One, compilers often have service packs and new versions. MSVC 6 has been patched up to service pack 5, IIRC. I would heartily recommend downloading any necessary service packs for MSVC 6. Of course, it''s been completely superceded by MSVC 7 and 7.1.

Another answer is that the C++ standard itself has changed over the years. The current version of the standard was released in 2003. However, there is no way to download a patch to MSVC 6 to get it to conform to the current standard. As far as I know, not even the current versions of Visual C++ still under development will conform to the current standard.

Also, unlike Java, because C++ is compiled into native code, you don''t need to download new runtime environments or anything like that.
quote:Original post by noVum
The newest C++ standard is 5 years old.

Wrong. It''s less than a year old, it was published in 2003 as ISO/IEC 14882:2003.
quote:Wrong. It's less than a year old, it was published in 2003 as ISO/IEC 14882:2003.

Apparently you are right. Is this C++0x ?


[edited by - noVum on March 5, 2004 5:29:01 PM]
quote:Original post by noVum
No. The latest release is ISO C++ 98 and the next version has the "codename" C++0x, but is not ready yet.


Incorrect. TC1 got released last year.

quote:Minutes of ISO WG21 Meeting, April 6, 2003
A revised edition of the IS with TC1 changes but without change bars will be published. This will be document 14882:2003(E).

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
quote:Original post by wolfbane
I just started c++ but have been doing Java for a while now. I was wondering if there are updated versions of c++ that have to be downloaded, like with Java. I am using Visual C++ 6.

C++ is a programming language, it's not a program. Visual C++ 6 is a program you can use to write and compile programs written in C++ and there are newer versions of it available but they're not free. To get a free C++ development environment you could try e.g. Dev-C++ whose compiler (MingW) also follows the C++ standard much better than VC.
quote:
One is to use a char string[10], while the other was to #include <string> and then just declare a string. Obviously I got the first way to work, but not the second.

You won't need any updates to get the methods you described working. The second way is preferable and easier to work with. Remember to put the following line after the #include lines:
using namespace std;  

Otherwise you would have to write 'std::' in front of the std variable declarations (e.g. std::string mystr)

EDIT: Damn you guys are fast!


[edited by - nonpop on March 5, 2004 5:32:03 PM]
You shouldn't use "using namespace std;"
This defeats the entire purpose of namespaces. Especially don't do that in headers.

quote:Dev-C++ whose compiler (MingW) also follows the C++ standard much better than VC.

Very wrong. VS .NET 2003 has one of the most standard compliant compilers that exist.

[edited by - noVum on March 5, 2004 5:33:42 PM]
quote:Original post by noVum
You shouldn''t use "using namespace std;"
This defeats the entire purpose of namespaces. Especially don''t do that in headers.

quote:Dev-C++ whose compiler (MingW) also follows the C++ standard much better than VC.

Very wrong. VS .NET 2003 has one of the most standard compliant compilers that exist.

I was comparing it against VC6 (but apparently not so clearly)
Just curious, does anyone know what ISO/IEC 14882:2003 contains, I couldn''t find any info on it''s contents, other than paying the ISO for a copy.

This topic is closed to new replies.

Advertisement