[oi-dev] g++ 4.7 headers issue

Alan Coopersmith alan.coopersmith at oracle.com
Thu May 30 06:46:57 UTC 2013


On 05/29/13 11:41 PM, Jean-Pierre wrote:
> What is the recommended way to state "This code is for Solaris-
> derived OSes" (as opposed to Windows, Linux, etc.) ? This is a
> frequent need when developping portable applications.
>
> And, I expected "#ifdef _sun" to mean just that, irrespective of
> compiler, instead of meaning "This code is meaningful to a
> Sun-derived compiler".

"#ifdef __sun" means you are compiling on a SunOS kernel, such as
Solaris or illumos - you could be using Studio cc, GNU gcc, or
LLVM clang compilers.

"#ifdef __SUNPRO_C" means you are compiling with the Sun/Solaris Studio
compilers - you could be building on Solaris/illumos or on Linux.

These names are trapped in history, based on the original names for
these products and can't be changed without breaking compatibility.

-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc




More information about the oi-dev mailing list