D Users Survey: Primary OS?
Chris via Digitalmars-d
digitalmars-d at puremagic.com
Fri May 30 04:20:34 PDT 2014
On Friday, 30 May 2014 at 09:25:40 UTC, Jacob Carlborg wrote:
> On 2014-05-30 00:13, Kiith-Sa wrote:
>
>> Or if you're working on tools, don't
>> make them for $OS, make them cross-platform. (I boycott
>> non-crossplatform tools
>> by default)
>
> That's not so easy, depending on what you're doing. Some things
> are done in completely different ways depending on the
> operating system. If you're luck you can code two versions, one
> for Windows and one for Posix. Low level stuff is usually
> platform dependent, even if it fall under one of the above
> categories. For example, getting the full path to the currently
> running executable looks completely different on Windows, OS X,
> Linux and FreeBSD.
But the basic code should compile. We've just had the case when a
coworker tried my code on Windows (I develop on Linux). It
compiled with the latest version of dmd. No questions asked. When
it comes to system stuff it's:
version (Windows) {
// some odd shit
}
version (OS X) {
// some other odd shit
}
version (POSIX) {
// normal stuff
}
But these are little things like the "tmp" directory and so on. D
usually compiles on all the major platforms.
More information about the Digitalmars-d
mailing list