Strangely, the following C++ program compiles on Sun Studio 10 without producing a warning for an undefined variable:
int main()
{
return sun;
}
The value of sun
seems to be 1. Where does this variable come from and what is it for?
It's almost certainly a predefined macro. Formally, the C and C++ standards reserve names starting with an underscore and a capital letter, or containing two underscores, for this, but practically, compilers had such symbols defined before the standard, and continue to support them, at least in their non-compliant modes which is the default mode for all of the compilers I know. I can remember having problems with `linux' at one time, but not when I invoked g++ with -std=c++89.