C language now truly universal

K

kerravon

Open letter/release announcement/tribute to Dennis Ritchie

To: Dennis Ritchie
From: Paul Edwards
Subject: C language now truly universal
Date: 2011-01-01


Hi Dennis.

Happy New One-based Decade (personally I'm a zero-based
fan, just like your C language).

Today, the first day of the new decade, I have just
formally released GCCVSE, a C compiler for z/VSE (an
IBM mainframe operating system), and would like to
dedicate this release on this day to you and the
language you created, and which most of my adult life
has revolved around. Note that I had to take 2 days
off work and was making last-minute code changes and
finalizing packaging on New Year's Eve to get this
out by today.

I'm not sure how familiar you are with the predecessors
to z/VSE, ie DOS/360 and then DOS/VS (which was released
the same year - 1972 - that you were fleshing out the
details of the C language, more-or-less). That operating
system was very far away from Unix, and I assume you had
little reason to deal with it, and more important things
to do.

I can tell you that I was not at all familiar with any
of these DOS versions until a couple of years ago. The
reason for that was that despite DOS/VS having been
popular in its day, today it is a barely-known, obscure
operating system that for whatever reason has resisted
the calls to simply die peacefully.

Unfortunately, there's the rub. It remains a commercially-used
operating system even today. It satisfies all the below
conditions:

1. Currently in commercial use.
2. Used by a company other than the owner.
3. Has a documented programming API.
4. Has a file system of some sort.
5. Has compilers, assembler and linker.
6. Currently has programmers employed to write software
using those compilers/assembler/linker running on that
machine, not merely as a cross-compiler target.
7. Programmers use an editor on that machine to write
their code.
8. Manages a variety of hardware, such as tape, disks,
terminals.

As such, it can't just be willed out of existence. It
may be the black sheep, but it's still there, right now.

As such, for C to be a universal language, it must be
available on z/VSE.

The good news is that IBM has a reasonably-priced and
fantastic C compiler for z/VSE, and has had for more
than a decade (on the predecessors). It's a must for
every organization that wishes to program in C.

But there's the next rub. C has never been popular on
IBM mainframes. Cobol is used almost exclusively. In
the unusual circumstance that Cobol isn't used, it's
PL/1 instead. C meanwhile is a latecomer and a bit of
a black sheep, although that is less true these days.
So an organization may well have no interest in C,
and thus no reason to buy a C compiler, and it is
difficult/impossible to cost-justify buying one.

Which means that a hypothetical (actually, not that
hypothetical, given that as recently as the last week
someone mentioned that management had decided to
axe their z/OS C compiler to save money) programmer, who
loves the C language, regardless of why or how that came
about, may one day find himself being asked by his
boss (current or future) to program on a z/VSE machine.
One that doesn't have a C compiler, since it doesn't
come standard, and isn't part of the core business,
and a solitary C programmer is unlikely to be able
to get the required purchase order raised and approved
in the first week he arrives to do the programming
work. Or even the first year. Even if he has a collection
of C utilities, originally written on a multitude of
platforms, yet all conforming to ISO/IEC 9899:1990,
so all will work on z/VSE, and considers them to be a
productivity aid, it is still unlikely that the
programmer will be able to get it cost-justified.

The situation changes radically when there is no cost
and no paperwork involved. When the question is
transformed into "would it be OK if I load some
free, open-source software onto the system to help
me with the work you have assigned me?", there's a
much higher chance of getting a reply of "sure,
that's fine by me". A conversation that will typically
take place exclusively in the programming department,
no administration people involved. Yes, theoretically
the answer could still well be "no", but it will be
due to an unrelated policy that can't be avoided,
rather than a cost barrier.

So now we have the good news that there are already
free, open-source C compilers available. There have
been for decades. They may or may not be as good as
their commercial counterparts, but programmers will
rarely be in a position where the differences would
be such that they would need to e.g. rewrite their
utility in Cobol because the free C compiler wasn't
good enough to do the job.

Back to the bad news. The free C compilers don't
support every single platform. It depends what CPU
you are trying to target. In addition, even if the
C compiler targets your CPU, it doesn't mean that
the C compiler itself will run on your platform,
because it may not have been written in a portable
manner, e.g. it may have assumed that the characters
'A' to 'Z' were consecutive in their binary representation,
which is not true on an EBCDIC machine. This prevents
it from ever being a normal hosted compiler. Next,
even if it was written portably, there is still the
C runtime library that is required. fopen() isn't
going to magically know the documented API of your
host machine.

Now for some personal history. I started working as
a tape jockey, I mean, Assistant Computer Operator,
in 1986, when I was 18 years old. The system was
MVS. I had prior programming experience both in my
first year of uni (electrical engineering - which I
hated), but mostly on my Commodore 64 (where I had
learned assembler also). In the area that I worked,
there were obviously more experienced people than me,
and at least one of them had programming experience and
appeared to be quite knowledgable. I thought I could
bypass a lot of personal research by simply asking
him "what is the best computer language?".

His answer was NOT "C". His answer was a question back
to me - "what is your definition of 'best'?". My answer
to that was "I want to be able to write a program today,
and regardless of how computers change in the next 10,
20, whatever years, I want that program to be able to
still run on that new system, without needing to change
it.".

THAT was when he answered "C" without hesitation. He
even mentioned that where there are differences, it
normally just involves some minor header file changes
for the different machines. I was sold! So off I went
to learn and use the universal language for computers.
It wasn't long before I bumped into my first barrier -
we didn't actually have a C compiler at work! So much
for being the world's universal language. How frustrating
is it when you wish to prepare for the decades ahead
and can't even start?

Fortunately I changed positions (to be a trainee systems
programmer) soon after, and I had a nice boss who was
willing to fill out the paperwork to get a C compiler.
And it was truly a beauty to behold - especially when
it changed from being a Program Offering to a Program
Product in the form of C/370. I would look at the
assembler listings and find code that was too complicated
(for maintenance purposes) to be the sort of thing that
would be hand-coded, but the compiler was free to do as
it pleased. So in some instances, generated better code
than I would write myself, at least performance-wise.

But eventually I changed companies, and found myself
back where I started - still on MVS, but without a C
compiler again! Back to handcoding stuff in assembler
that could so easily have been generated. Just what
was the barrier to having a universal language for
computers? Shouldn't someone "in charge" be "doing
something"? Why would there be a "no child left
behind" policy without a "no programmer left behind
policy" for when the child took up programming?!

I spent what appeared like the next 40 years wandering
around the Sinai looking for the guy in charge of this
mess (as well as the famed "dropped quarter"). My
travels led me to GCC numerous times, which was
actually able to generate S/370 code since about
1989, around the time I was stuck without a C compiler
(although that new company did eventually buy SAS/C,
another thing of beauty). However, even though GCC
was generating S/370 code, there were four problems:

1. It came with a notice that the software (approx
400,000 lines of C code, which we now know generates
about 700,000 lines of S/370 assembler) itself didn't
work on S/370.

2. Even if it could cope with the hardware, it still
wasn't written with the MVS API in mind.

3. Even if the GCC application was written in 100%
C90, someone still needs to write the C runtime
library.

4. The S/370 code generator had never been in a position
of being tested in anger, and was riddled with bugs.

In 1994 I set about on task number 3, because I thought
it was more valuable, achievable and strategic to
concentrate on that, while waiting for the guy in charge
to eventually show up. I had this in a sufficiently
operational state by 1997, working with IBM's C compiler.

The guy in charge appears to have been Dave Pitts, and
he mostly took care of the first issue, by around 2002.

Another thing happened in this timeframe - the Hercules
(IBM mainframe emulator) became available, plus old public
domain IBM mainframe operating systems became available.
One of the beauties of IBM operating systems is their
upward compatibility. So if you coded according to the
rules of the day, your executables would continue to
work.

With the enormous help of Phil Roberts and Dave Wade,
and starting in 2003, I addressed issue 2, by working
around the GCC Posix assumptions, and also dealing with
numerous other environmental considerations, and by
2004, GCCMVS was born, and self-compiling natively on
MVS. MVS (aka z/OS) was by far the most important of
the three general-purpose IBM mainframe operating
systems.

By 2006, the only other operating system of any real
relevance - CMS - was also covered, mainly via the
appropriate PDPCLIB changes (ie issue 3).

By 2009, issue 4 had been dealt with, as I finally
had the skills to fix the machine definitions myself.

Also in 2009 I asked in comp.lang.c if anyone could
name a commercially used operating system besides
z/VSE, that didn't have either a C compiler as
standard (or that it would be unthinkable that one
would not be available), or have a free one available.
None could be named.

So all that remained was for z/VSE users to please
power off their systems, so that my mission in life -
to ensure that no operating system would be left
behind - could finally come to a close.

By 2010 I finally cracked and decided to bite the
bullet and learn enough about VSE (and I can honestly
say, this is the most hostile API I have ever
encountered - makes MVS look like a walk in the
park, and took a while to encapsulate so that C
programs could run unchanged as God/Dennis Ritchie
intended - although the encapsulation of MVS took
far longer, and was a precursor). And that's what
this release is about. The final nail in the coffin.
Absolutely everything is covered, as far as I know.
No programmer need ever fear going to a job where
he can't point out that a plethora of C tools exist,
and are already supported on this platform, if he
is just given 5 minutes alone with a broadband
connection.

When I started writing this message, I was still
doing the MVS-targetted build - it takes about
2 hours to get GCC to recompile itself on my laptop
with the Hercules emulator. And that's a minimalist
rebuild, avoiding the bison generation, and cheating
(but still kosher) by using the PC natively to do
a stage. Normally I would do the full regeneration,
but this release the focus is on GCCVSE, which,
while natively hosted, is not currently set up
(supporting scripts etc) to rebuild itself. It is
however, fully functional. I completed the message
shortly before the CMS build finished, leaving just
the VSE build, and with www.worldtime.org informing
me that in less than 2 hours, the rest of continental
USA will have ticked over.

So I will upload the software when Los Angeles ticks
over, send this email to you, wait 1 hour, then post
everywhere else. I doubt that when you were inventing
the C language you had any idea just how much impact
it would have on the world. Nor how much it would
guide an individual's entire life (career spent
wandering around new computer systems to find out
what their C compiler looked like). But the story
will not be ending there, as I have used GCCMVS
to write a new MVS-API-compatible operating system
(PDOS/390) in C, so that as far as possible I can
stick to clean living - ie using an OS written
in C, using a C compiler written in C, using a C
runtime library written in C, and using an editor
written in C (I do my editting on Windows - written
in C - before uploading the code via emulated tape
to the mainframe in question - although that's
mainly so that I can use a source control system
written in C, rather than to avoid using a
mainframe editor not written in C).

Anyway, I realise that you nor anyone much else has
a use for it, but for posterity, the GCCVSE compiler
can be found here:

http://gccmvs.sourceforge.net

And will also be part of VSE/380, a 31-bit variant
of DOS/VS R34, available here:

http://mvs380.sourceforge.net

And for completeness, the C runtime library has its
own project website too:

http://pdos.sourceforge.net

I'd also like to note that none of the targets
would be in the state they are currently in if it
weren't for the assistance of members of the
Hercules community - e.g. Gerhard Postpischil's
rewrite of the assembler portion of PDPCLIB's
MVS target.

So thankyou Dennis, and good luck with whatever you
are currently doing, which hopefully isn't writing
any new languages, since in practice it took many
many years after the C standard was released before
the C compiler I was using at work - even on Unix -
would e.g. do a free(NULL) without coredumping.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top