-
September 7th, 2011, 01:26 PM
#1
VS2010 Compilation Warnings
Hello, using VS2010 I am not getting the compilation warnings I used to get with VS2008.
For example:
float x=1.0;
...would cause a warning in VS2008 because I didn't append an 'f' like so: x=1.0f;
Also, I increased the warning level to 4 under Project->Properties->Configuration Properties/C++ and that gives me additional warnings (but not the warning I detailed above) when I build the whole project but not when I simply compile a file, which is annoying.
Can I set it up so it's similar to the way it used to be ?
Thanks.
-
September 7th, 2011, 02:55 PM
#2
Re: VS2010 Compilation Warnings
Is there any very important reason for you to use float type instead of double?
Victor Nijegorodov
-
September 7th, 2011, 03:14 PM
#3
Re: VS2010 Compilation Warnings
Originally Posted by endemoniada
Hello, using VS2010 I am not getting the compilation warnings I used to get with VS2008.
For example:
float x=1.0;
...would cause a warning in VS2008 because I didn't append an 'f' like so: x=1.0f;
What warning did you get in VS2008? (I am not getting any, except for "local variable is initialized but not referenced")
Originally Posted by endemoniada
Also, I increased the warning level to 4 under Project->Properties->Configuration Properties/C++ and that gives me additional warnings (but not the warning I detailed above) when I build the whole project but not when I simply compile a file, which is annoying.
Can I set it up so it's similar to the way it used to be ?
Are you sure? I am getting exactly the same warnings compiling one file. Coud it be that it was up to date and not compiled at all? The behavior is the same in VS2008 and VS2010.
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
-
September 7th, 2011, 04:13 PM
#4
Re: VS2010 Compilation Warnings
What warning did you get in VS2008? (I am not getting any, except for "local variable is initialized but not referenced")
I would get a warning such as: "conversion from double to float, possible loos of data". I don't get that in VS2010.
Are you sure? I am getting exactly the same warnings compiling one file. Coud it be that it was up to date and not compiled at all? The behavior is the same in VS2008 and VS2010.
Yes, you are correct. The warnings were under Link so they wouldn't show up when it was up to date.
-
September 8th, 2011, 08:45 AM
#5
Re: VS2010 Compilation Warnings
Originally Posted by endemoniada
I would get a warning such as: "conversion from double to float, possible loos of data". I don't get that in VS2010.
Could you please post your exact code and compiler warning?
This test:
Code:
int main()
{
float x = 1.0;
double d = 2.0;
x = d;
return 0;
}
produces only one warning (as expected):
1>d:\code\2008\test\test\test.cpp(5) : warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
for the assignment x = d;
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio:
FeinWindows - replacement windows manager for Visual Studio, and more...
Tags for this Thread
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
|