Determining OS

Kevin Ingwersen ingwie2000@googlemail.com
Tue Apr 1 21:24:00 GMT 2014


Hey.

I want to create a C function that returns the OS that this program is runing on - so, a „basic“ uname. What is the best way to achieve this, cross-platform? The possible build environments might be

	- Linux + GCC or Clang
	- Mac OS X with Clang
	- Windows with cl.exe or GCC or clang

I want to return an entry of an enum, or something similar. Values might be:

	- linux
	- win32
	- mingw
	- mac

How can I best do this?

Kind regards, Ingwie


More information about the Gcc-help mailing list