13 July 2007

Enabling Solaris 64-bit C++ warnings

To enable Sun Studio to print out full C++ 64-bit porting warnings you need to use +w & -xport64. I found that -xport64 on its own didn't do anything.
+w        Print warnings about additional questionable constructs
-xport64 Enable extra checking for code ported from 32-bit to 64-bit platforms

The warnings are extremely useful in cleaning up C++ code with regards to 64-bit portability.

Another useful option is :
+w2        Emit warnings for code with additional portability problems

See "CC -flags" for full options and usage.