[OT] mobile rising

Jonathan M Davis newsgroup.d at jmdavisprog.com
Wed Nov 8 13:08:06 UTC 2017


On Wednesday, November 08, 2017 12:35:19 codephantom via Digitalmars-d 
wrote:
> On Wednesday, 8 November 2017 at 11:47:32 UTC, Jonathan M Davis
>
> wrote:
> > Personally, I think that the best course of action in general
> > as a developer is to try and make your software as
> > cross-platform as reasonably possible and let folks run
> > whatever they want to run. A lot of the OS-related problems we
> > have stem from the fact that too often, software is written for
> > a specific OS (and not just Windows software is guilty of that).
>
> Well.. that was the role that POSIX was meant to play. Even
> Windows was on board, sort of, for a short time. What a joke that
> all turned out to be.
>
> "Perfect application portability across UNIX-based OSes is
> clearly beyond the realm of possibility." (from the 2016 paper
> below)
> -
> http://www.cs.columbia.edu/~vatlidak/resources/POSIXmagazine.pdf
>
> (conclusion: "We believe that a new revision of the POSIX
> standard is due, and we urge the research community to
> investigate what that standard should be."
>
> btw. I wonder if anyone has got the linux version of DMD x64 to
> run on the Windows Subsystem for Linux (available in Windows 10 I
> believe).

POSIX certainly helps, but each OS that implements it adds more stuff on top
of it (like extra flags or similar but different system calls that improve
on the POSIX ones), and there's plenty of stuff that's simply not part of
POSIX but is all over the place in slightly different forms, since it's not
part of a standard. Heck, even when something is part of POSIX, that doesn't
mean that it's properly and fully supported on a system that supports POSIX
- e.g. the stuff that's in librt (like clock_getttime) isn't implemented on
Mac OS X even though it's part of POSIX, so the stuff for getting the time
in core.time and std.datetime has to be different for Mac OS X. Granted, the
Mac OS X calls are actually better, but you're still stuck implementing the
code differently for different OSes in spite of a standard.

And while historically, Windows implemented some POSIX stuff, they went and
slapped an underscore on the front of all of the names, totally breaking
compatibility. The new Windows Subsystem for Linux should be a huge step
forward in some regards, but if I understand correctly, it's basically an
emulation layer for running linux programs and not something you'd use as
part of a Windows program. So, it only works if you're just looking to run
Linux programs under Windows, not if you want to write a program that runs
as part of Windows and can take advantage of the Windows stuff where it
needs to. So, how useful it is depends on what you're trying to do.

Improvements to standards to allow for more stuff to be written in a
cross-platform manner without versioning stuff it off for specific OSes is
definitely desirable, but the reality of the matter is that even OSes that
are very similar end up with differences that occasionally require
versioning code - sometimes even when the API being used is part of a
standard. And much as things could be improved, I don't see that ever
changing. It sure doesn't help though when each OS goes off and implements
something drastically different for core stuff (like opengl vs directx).
Some competition is good, but when a major API is platform-specific, it
makes it a _lot_ harder to write cross-platform code.

Ultimately though, even when dealing with different BSDs, you end up with
portability problems if you're not careful.

- Jonathan M Davis



More information about the Digitalmars-d mailing list