Are there any macros to determine if my code is being compiled to Windows? [duplicate]

[Edit: I assume you want to use compile-time macros to determine which environment you’re on. Maybe you want to determine if you’re running on Wine under Linux or something instead of Windows, but in general, your compiler targets a specific environment, and that is either Windows (DOS) or it isn’t, but it’s rarely (never?) both.] … Read more

What’s the difference between operating system “swap” and “page”? [closed]

In spite of the historical interchanging of these two terms, they indicate different things. They are both methods for managing moving data in memory to another storage device, called a backing store (often a hard drive), but they use different methods of doing so. Swapping involves the moving of a process’s entire collection data in … Read more

Exit codes bigger than 255 — possible?

Using wait() or waitpid() It is not possible on Unix and derivatives using POSIX functions like wait() and waitpid(). The exit status information returned consists of two 8-bit fields, one containing the exit status, and the other containing information about the cause of death (0 implying orderly exit under program control, other values indicating that … Read more

Is there a Python equivalent to the ‘which’ command [duplicate]

Python 3.3 added shutil.which() to provide a cross-platform means of discovering executables: Return the path to an executable which would be run if the given cmd was called. If no cmd would be called, return None. Sample calls: >>> shutil.which(“python”) ‘/usr/local/bin/python’ >>> shutil.which(“python”) ‘C:\\Python33\\python.EXE’ Unfortunately, this has not been backported to 2.7.x.