News for hackers. Stuff that matters.
Re:How to Write Portable C Without Complicating Your Build by pjmlp on Friday March 31, 2017 @03:55AM (#14001887)
> Prior to that there have been very few alternatives to C.

There were, but the market chose otherwise.

Re:How to Write Portable C Without Complicating Your Build by bluGill on Friday March 31, 2017 @11:30AM (#14004783)
> There were, but the market chose otherwise.

That depends on what you mean by alternative to C. If you are just looking for a "portable assembly" or systems programming language: there were many alternatives.

If you are looking for the systems programming language that has a chance building and running the same source code on multiple different systems then you have to wait until Posix which is tied to C.

Of course you can well argue that once you have Posix, C is not actually required. You just need a language that can call C style functions (this is a trivial exercise for many languages) with compilers for the platforms you are interested in (not trivial, but it is straight forward work that has been done often enough that it is well understood).

Most people mean Posix+C when they say there were no alternatives to C, and in this form they are correct. The other choices may be better for most definitions of better, but there are few alternatives that let you write code and have a chance of it running on something else.

Re:How to Write Portable C Without Complicating Your Build by pjmlp on Friday March 31, 2017 @04:00PM (#14007587)
You don't need POSIX at all if the language has a rich set of libraries.

In a way, I always though of POSIX as the C batteries that ANSI didn't want to make part of ANSI C, to make it easier to create compliant compilers.

Which was kind of wasted effort, because to make it easier to port code, many C compilers outside UNIX always bundled a subset of POSIX with them.

Re:How to Write Portable C Without Complicating Your Build by bluGill on Friday March 31, 2017 @04:27PM (#14007851)
>You don't need POSIX at all if the language has a rich set of libraries.

Agreed, but that increased the cost of porting a language to the new platform. The larger (and richer) the library the more expensive it is. Unless your large library is built on a smaller internal library (like Posix).

Note that I'm arguing that C was the first to really achieve this. I'm not arguing C is the best choice, not am I arguing that the other languages couldn't have reached that. There are other languages (some better than C) that could have done just as well, but for some reason didn't.

Re:How to Write Portable C Without Complicating Your Build by ue_ on Friday March 31, 2017 @06:36AM (#14002525)
Out of interest, what were the alternatives? As much as I'd love a world in which we were on Lisp machines or running Dylan, these weren't exactly alternatives to C at the time to my knowledge.
Re:How to Write Portable C Without Complicating Your Build by pjmlp on Friday March 31, 2017 @06:59AM (#14002599)
Before C was brought into the world, OSes were being written in Algol, PL/I dialects, since 1961.

At Xerox PARC they moved from BCPL into Mesa, used to write Xerox Star and Pilot OSes. Also one of the first IDEs, also known as Xerox Development Environment (XDE). The year was 1976.

Mesa eventually got automatic memory management support (RC with a local tracing GC for collecting cycles) and became known as Mesa/Cedar.

Niklaus Wirth created Modula-2 in 1976 after his first sabbatical at Xerox given his experience with Mesa, used it to create the Lilith workstation at ETHZ, this was followed a few years later by Oberon for the Ceres workstation, inspired by Mesa/Cedar after his second sabbatical at Xerox.

The OOP extensions that Borland added into Turbo Pascal are actually from Apple's Object Pascal, used to create Lisa's OS and the initial versions of Mac OS, before Apple decided to make the development tools appealing to the growing UNIX workstation market and introduced Macintosh Programmer's Workshop.

On MS-DOS compatible systems, which were written in Assembly, there was a plethora of Basic, Pascal, Modula-2, C and C++ compilers to choose from. Plus business languages like Cobol and xBase.

It was only with the success of Watcom C++ adoption among game developers, thanks to its DOS extender, and the move to OS/2 and Windows 3.1 that C and C++ started to grow in adoption.

However most developers on OS/2 and Windows 3.1 were actually adopting C++ frameworks like CSet++, OWL and MFC, or alternative environments like TPW, Delphi or VB. Mac guys had Powerplant.

On Windows 3.1, C++ patterns like RAII were already common place, and even though each compiler had its own library, all of them provided support for safe strings, vectors and some form of smart pointers.

Writing pure C on Windows, besides Microsoft themselves, has always been mostly done by those porting UNIX stuff into Windows.

Even Microsoft by the time they released the Windows 3.1 SDK, a new set of macros was introduced to try to make it safer to code in plain C.

https://support.microsoft.com/en-us/help/83456/introduction-...