Neil Mitchell wrote:
#ifdef __WIN32__
    (Windows code)
#else
    (Linux code)
#endif

In Yhc, we use a runtime test to check between Windows and Linux.

I think the cleanest solution is to factor the OS-specific code into separate modules with OS-independent interfaces and names, and pull in the appropriate implementations at compile time by changing the module search path. That way you avoid the syntactic and semantic ugliness of cpp as well as most of the practical problems of a runtime test.

You can also use any two or all three of these techniques together.

-- Ben

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to