Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

wolfbane

are there c++ updates?

This topic is 5275 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!