#include<stdio.h>/**
* Determination a platform of an operation system
* Fully supported supported only GNU GCC/G++, partially on Clang/LLVM
*/#ifdefined(_WIN32)#definePLATFORM_NAME"windows"// Windows#elifdefined(_WIN64)#definePLATFORM_NAME"windows"// Windows#elifdefined(__CYGWIN__)&&!defined(_WIN32)#definePLATFORM_NAME"windows"// Windows (Cygwin POSIX under Microsoft Window)#elifdefined(__ANDROID__)#definePLATFORM_NAME"android"// Android (implies Linux, so it must come first)#elifdefined(__linux__)#definePLATFORM_NAME"linux"// Debian, Ubuntu, Gentoo, Fedora, openSUSE, RedHat, Centos and other#elifdefined(__unix__)||!defined(__APPLE__)&&defined(__MACH__)#include<sys/param.h>#ifdefined(BSD)#definePLATFORM_NAME"bsd"// FreeBSD, NetBSD, OpenBSD, DragonFly BSD#endif#elifdefined(__hpux)#definePLATFORM_NAME"hp-ux"// HP-UX#elifdefined(_AIX)#definePLATFORM_NAME"aix"// IBM AIX#elifdefined(__APPLE__)&&defined(__MACH__)// Apple OSX and iOS (Darwin)#include<TargetConditionals.h>#ifTARGET_IPHONE_SIMULATOR ==1#definePLATFORM_NAME"ios"// Apple iOS#elifTARGET_OS_IPHONE ==1#definePLATFORM_NAME"ios"// Apple iOS#elifTARGET_OS_MAC ==1#definePLATFORM_NAME"osx"// Apple OSX#endif#elifdefined(__sun)&&defined(__SVR4)#definePLATFORM_NAME"solaris"// Oracle Solaris, Open Indiana#else#definePLATFORM_NAMENULL#endif// Return a name of platform, if determined, otherwise - an empty stringconstchar*get_platform_name(){return(PLATFORM_NAME ==NULL)?"": PLATFORM_NAME;}intmain(int argc,char*argv[]){puts(get_platform_name());return0;