You could try to use both these macros:
__SUNPRO_CC
(for C++) or__SUNPRO_C
(for C), which are macros typically defined by the SparcWorks compiler indicating the usage of Sun C/C++ compiler;__sun
, which is a macro defined by the SunOS platform, indicating the usage of the Sun compiler.
#if defined(__SUNPRO_CC) && defined(__sun)// Specific code for SparcWorks compiler on SunOS#else// Code for other compilers or platforms#endif
Maybe useful reference: Sun™ Studio 12: C++ FAQ