Author Topic: Loss of Data Warning  (Read 2798 times)

Offline wolfcry

  • Multiple posting newcomer
  • *
  • Posts: 30
Loss of Data Warning
« on: February 12, 2011, 03:54:53 pm »
Hello,

Not sure if this goes in the bug section or not (most likely a setting I changed without realizing) but C::B is no longer issuing me warnings about possible loss of data due to unsafe conversion types (eg. double to int conversion etc.) and I could have sworn it did before I went to 10.5.

I checked the compiler flag options in the Settings >> Compiler and debugger section and I do have enable all compiler warnings checked as well as all other warning options checked (over-the-top I know but I'm extremely picky about clean code).

I tested my compiler (Mingw-g++) using a different IDE and it kicks the warning out like it was supposed to so I know it's not that. Just not sure where in C::B this is being filtered out.

For example, this tid bit should kick out the warning like it does with the other IDE but it doesn't:
Code
double a = 8.5;
int d = a;

C::B version and OS is in my sig as always.
C::B Version = 10.5
OS = Microsquish XP

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7589
    • My Best Post
Re: Loss of Data Warning
« Reply #1 on: February 12, 2011, 04:01:43 pm »
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Edit: Only compare a re-build to a Re-Build; never a build to a build.
« Last Edit: February 12, 2011, 04:27:11 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline wolfcry

  • Multiple posting newcomer
  • *
  • Posts: 30
Re: Loss of Data Warning
« Reply #2 on: February 12, 2011, 04:50:55 pm »
Hey Stahta01 and thanks for the help.

I'm not exactly sure why (unless updating C::B erased my additional option settings), but the other options (including Wconversion which should be a default option flag in C::B or at the very least, an option you can set), were gone.

I had already viewed the build log before posting (and was mistakingly thinking another option was the flag I was looking for lol) but didn't realize -Wconversion was missing until looking over the log for the umpteenth time :? Oi is all I can say about that one lol.

For those new to C::B and for those that want this warning, you set the -Wconversion flag at (hopefully this helps):
Settings >> Compiler and debugger >> Other Settings (tab directly to the right of Compiler Flags tab).




C::B Version = 10.5
OS = Microsquish XP