VS2010 Compilation Warnings
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: VS2010 Compilation Warnings

  1. #1
    Join Date
    Apr 2011
    Posts
    18

    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.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,611

    Re: VS2010 Compilation Warnings

    Is there any very important reason for you to use float type instead of double?
    Victor Nijegorodov

  3. #3
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,554

    Re: VS2010 Compilation Warnings

    Quote Originally Posted by endemoniada View Post
    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")
    Quote Originally Posted by endemoniada View Post
    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:
    FeinViewer - an integrated GDI objects viewer for Visual C++ Debugger, and more...

  4. #4
    Join Date
    Apr 2011
    Posts
    18

    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.

  5. #5
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,554

    Re: VS2010 Compilation Warnings

    Quote Originally Posted by endemoniada View Post
    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:
    FeinViewer - an integrated GDI objects viewer for Visual C++ Debugger, 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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center