in reply to code that runs (and works) on both Linux and Win32

This is a situation where I really like to see the use of a class hierarchy:   an abstract class, with one or more OS-specific implementations, and a “class factory” that knows how to instantiate just exactly the flavor that you need.   All of the OS-type detection occurs in the class-factory.   The OS-specific routines don’t have to:   “I exist, so it must be Win32, so I must be in hell ...”   ;-)