Sign in to follow this  

testing to see it toolkit compiler works with visual C++.net standard

This topic is 4685 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 finally found a place that hade Visual C++.net standard and i download the 2003 toolkit and copied the 5 file from the bin to the visualC++.net bin folder. i have a simple console project up, my question is it there are type of code i can do the The standard compiler would give me a error or warning and the optomized compiler would not just to test to see if the optomized compiler is truly working?

Share this post


Link to post
Share on other sites
I believe that if you specify optimization options, the non-optimizing compiler will warn you that they aren't supported. Other than that, you can compare the ASM outputs (there's an option somewhere to produce an ASM listing), or, assuming the non-optimizing compiler doesn't support NRVO (which is an optimization), check if


#include <iostream>

struct Foo
{
Foo() { std::cout << "Constructor" << std::endl; }
Foo(const Foo&) { std::cout << "Copy constructor" << std::endl; }
Foo& operator=(const Foo&) { std::cout << "Copy assignment" << std::endl; return *this; }
~Foo() { std::cout << "Destructor" << std::endl; }
};

Foo bar() { Foo f; return f; }

int main()
{
Foo f = bar();
}





does optimize some of the copying away (GCC only prints out "Constructor" "Destructor").

Share this post


Link to post
Share on other sites
Quote:
Original post by 3dmodelerguy
well that code work fine no warnings so i guess it works, right?


Probably, though you'd have to try it explicitely with the non-optimizing compiler to make sure: it might still have been built in. NRVO is one of the few optimizations which is actually allowed to change the program's behavior (eliminates calls to copy constructors, even though they might have side-effects).

Share this post


Link to post
Share on other sites
Go to the prohject settings and add some optimisation compiler switches in the Release configuration, e.g. /Ox.
The standard compiler will warn about disabled features if you compile while the professional toolkit won't.

Share this post


Link to post
Share on other sites

This topic is 4685 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this