Search code examples
delphidelphi-2010

How do I disable UNSAFE_CAST option?


I get a warning when i compile my project.

[DCC Warning] ...W1047 Unsafe code '^ operator'

On build info:

Target CoreCompile: ....\dcc32.exe -$W+ -$J+ --no-config ... -W+UNSAFE_TYPE -W+UNSAFE_CODE -W+UNSAFE_CAST

I know that I can set this off, but I can't find where todo this on delphi 2010. On Project>Options>Delphi Compiler>Hint and Warnings: I have Unsafe code, unsafe type and unsafe typecast to false

Can somebody help me.


Solution

  • If the warnings are disabled in the IDE options dialog, then the command send to dcc32 will not enable them. Which leads me to believe that the warnings are enabled in the IDE options.

    So, my guess is that you have multiple build configurations and are looking in the wrong build configuration in the IDE.

    I always get confused by the way the IDE presents build configurations. You may find it easier to search the .dproj file in a text editor. Look for DCC_UNSAFE_CODE, DCC_UNSAFE_CAST and DCC_UNSAFE_TYPE. You can then delete all of those entries and your settings will revert to the default value, which is not to warn.