Created
September 8, 2011 16:55
-
-
Save mohiji/1203900 to your computer and use it in GitHub Desktop.
Pre-processor abuse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef WIN32 | |
WSADATA g_wsadata; | |
#define StartSocketLib WSAStartup( MAKEWORD(2, 2), &g_wsadata); | |
#define CloseSocketLib WSACleanup(); | |
#else | |
#define StartSocketLib {} | |
#define CloseSocketLib {} | |
#endif | |
/* Used later on like this: */ | |
void main() { | |
StartSocketLib; | |
// do networky stuff | |
CloseSocketLib; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment