How to use #ifdef WIN32
Jim Burton
jim at sdf-eu.org
Thu Dec 20 20:30:58 EST 2007
Neil Mitchell wrote:
> Hi Jim
>
> <answer>
>
> #if defined(mingw32_HOST_OS) || defined(__MINGW32__)
>
> </answer>
Thanks Neil,
Jim
>
> <rant>
>
> If you want to test for Windows you have to ask whether an unrelated
> system is installed on your machine. Even if it isn't, you still have
> to test this value. This is what I call a "bug".
>
> You might also want to use System.Info.os and test this value
> dynamically rather than as a preprocessor, that keeps both code
> branches type checking and probably isn't much more expensive at
> runtime. Guess what the value of "os" returns on Windows? (hint: its
> ill-typed, being not an operating system)
>
> </rant>
>
> Thanks
>
> Neil
>
--
Jim Burton
More information about the Glasgow-haskell-users
mailing list