Old 12-08-2018, 04:10 PM   #1
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default (SWS) Linux specific code? (SOLVED)

For non Windows specific code the current way in SWS is (afaik)
Code:
#ifdef _WIN32
// Windows specific code here
#else
// non Windows specific code here
#endif
How can we differ the non Windows specific code for OSX and Linux?

edit:
I found
Code:
#ifdef __linux__
would that work?

Last edited by nofish; 12-08-2018 at 04:21 PM.
nofish is offline   Reply With Quote
Old 12-08-2018, 04:17 PM   #2
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

The __linux__ macro is defined on Linux and __APPLE__ is on macOS.

Code:
#ifdef _WIN32
  // Windows code
#elif __APPLE__
  // macOS code
#else
  // Linux/generic code
#endif
cfillion is offline   Reply With Quote
Old 12-08-2018, 04:20 PM   #3
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,096
Default

My edit crossed with your answer. Thanks!
nofish is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:41 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.