On 18/05/2020 15:11, Paul Edwards wrote:
> On Monday, 18 May 2020 16:54:12 UTC+10, David Brown wrote:
>
>> What I can't understand is your hypothesis that it is relevant or
>> important for something other than the joy of the journey.
>
> I guess I can't explain that very well. But I will try anyway.
>
> In my opinion C90 was the moment that we (finally!) had a universal
> language for computers. What was then needed (in my opinion) was for
> this language to be spread to all computers. Similar to the "one
> laptop per child" project, I expect a "one language per programmer"
> project so that no programmer should be without THE standard language
> - C90.
Well, I suppose I can't say your opinion is /wrong/, but I think it is
both over-simplified and (without knowing you or your background - so
don't take this as an insult) uninformed and inexperienced. There were
portable languages before C90, and portable languages afterwards, and
both before and after C90 there have been other languages far better at
handling many different tasks.
At the time it was standardised, C90 was perhaps the language with the
widest spread of possible applications and implementations. But there
were already better choices for many kinds of applications (higher level
languages made more sense for applications, C has always been poor on
8-bit accumulator-based processors, FORTRAN was faster for numerical
work). And at by 1990, the computing world had stabilised on systems
with 8-bit bytes and all data being a power of two bytes, with two's
complement signed integers. Apart from very specialised processors
(such as DSPs), and legacy systems, that covered everything - C has
always been unnecessarily flexible since that time. On the other hand,
it has always been a poor choice for smaller processors (even if it is
the best choice available).
The programming world has always had a range of programming languages
suited to a range of purposes - and that is how it should be. It would
be a much poorer world with just one "standard" system. Amongst other
things, C is not a good choice of language for learning to program.
Don't get me wrong - I like C, I use it for most of my work, and it is a
language which is ideal for certain kinds of use. But that does not
make it the ideal for /all/ use, or for /all/ programmers.
And I can't see any benefits in C90 over C99 - C99 is a significantly
better language in many ways. (C11 is better again, though the
differences are smaller except in support for multi-threading and
atomics. C18 has even fewer differences.) I can't imagine why anyone
would /choose/ C90 over C99 as a language.
In designing a general-purpose OS, it makes perfect sense that a C
compiler would be one of the earliest tools to provide - and the ability
to run code written in C is essential. But it makes no sense to me to
focus on that or limit anything to C.
>
> I have personal experience at being at a company with no C90
> compiler, so I was unable to bring my tools with me. That was because
> there was one environment that didn't have GCC ported to it - MVS
> (IBM mainframes). So I have spent an enormous amount of effort
> porting GCC not just to MVS, but also CMS, VSE and MUSIC/SP (all
> mainframe platforms).
OK, I can understand that wanting a C compiler for the systems you work
with.
>
> Now there is no commercially-used programming platform that doesn't
> have a free or standard C compiler available to it. So you can write
> your tools in C90 and be confident that they will work wherever you
> go.
You can write them in C99 too, in almost every case. But no, you most
certainly can't be confident that your C code will run everywhere -
unless you rely on pure standard C, which is rarely sufficient for any
purpose.
>
> The main exception to that is that the SDCC compiler doesn't support
> "double", but I'm guessing you can define "double" and "float" and
> have your tools build successfully.
If you think that is "the main exception", then you are very much
mistaken. There are lots of embedded compilers that have limitations in
their C support, and many have significant non-conformities. In
addition, they are freestanding compilers, not hosted compilers, and
have no guarantees about any library support. But the other viewpoint
here is that SDCC and other such embedded compilers are utterly
irrelevant to a general-purpose PC operating system.
>
> But this is an example of where I see that C90 hasn't quite been
> implemented properly. Another example is that we have multiple C90
> compilers, but no-one has ever been willing to release one to the
> public domain. So the public does not yet own a C90 compiler.
The public does not "own" any public domain software. And the public
does not /want/ public domain C90 compilers. Anyone who wants quality
C compiler for zero cost can get one under the two main free license
types - BSD (for clang/llvm/ and GPL (for gcc). There would be almost
no advantage for anyone in having a public domain compiler (and maybe
some direct disadvantages).
> I would
> have expected an organization like the CSIRO to be tasked with
> remedying that situation, but no government has felt it desirable
> that the public owns the means to program. If ever there is a reason
> we need to fall back to public domain software, the cupboard is
> mostly bare.
>
What reasons are you imagining here? What do you think people can do
with a public domain compiler that the could not do with a BSD or GPL
licensed tool?
> The fact that most people aren't willing to release their software to
> the public domain means that they see something that is possible if
> they do so, and they don't want that possibility to exist. I want to
> see that possibility - whatever it may be - to exist!
>
The main that is possible with public domain software is for others to
take it, slap their own copyright notice on it, and sue the original
author if they try to use, distribute or sell the code they wrote. Lots
of people (and companies) are happy to give away their work for free
with the condition that it stays free - and some are willing to do so
with just the condition that others don't claim they own it.
> Furthermore, I like the idea that there is just one language you need
> to learn, and you will be able to maintain an entire platform. C90 is
> the ticket. An enormous amount of effort was spent standardizing the
> language, and a truly beautiful job has been done if you read the
> standard. And an enormous amount of effort has been spent making C
> work nicely on MVS, so that truly beautiful executables can be
> created, that work as desired in both TSO and batch and on any
> RECFM.
You are using a lot of acronyms here that all appear to be specific to
IBM mainframes. That is an important, but very niche and mostly
outdated world.
>
> At the time that C90 was created, the 32-bit processor that mattered
> was the 80386.
Plus a dozen other 32-bit architectures, and with some 64-bit processors
coming along. And there were dozens of 8-bit and 16-bit architectures
that were important at the time.
> I don't think we should be coding for the 8086. I
> think that was the wrong solution for addressing memory greater than
> 64k. I think what was required was 32-bit address registers.
>
> I would like to be able to "lock in" the technology we had in 1990.
> We had the 80386SX processor, and we had an internationally-agreed
> language. What we should now be doing is adding: setlocale(LC_ALL,
> ""); to our programs and implementing international locales, to make
> C90 be as good as it can be.
Yes, C90 was an important step in programming history - but the world
has moved on since then. It is ridiculous (other than for historical
reasons, or fun) to limit anything to computing technology that is over
30 years old.
>
> I don't think we should be straying far from assembler. I think we
> should be writing code that in C that is close to what would be
> written in assembler, and to reduce the energy requirements of our
> code.
If you want that, then C (C90 or otherwise) is not the language for you.
It is a high level language, and is far from assembler.
>
> I think that we should have a clear roadmap for recreating
> civilization after a natural disaster, or if we find that we've been
> teleported to somewhere around Alpha Centauri.
If you want that, you should be working with valve computers. That is
about the last generation of technology where things are physical enough
to be worked on directly. If our society breaks down to the point where
we lose the ability to make the latest i7 or Ryzen processors, we will
also be incapable of making 80386SX processors.
> We should work to get
> a C compiler up and running as quickly as possible. The other
> programming languages that you think are superior to C should be
> written in terms of C. What we need is for Earth to transmit the most
> basic C compiler possible to us. Or for a team to memorize it like
> some people memorize the Koran. It should be written down on paper
> waiting for the day that computers are finally created.
>
> We don't actually know how the universe has been created. I want to
> see if the universe will collapse after a public domain C compiler
> has been implemented, which enables the third world, or North Korea,
> to support their own programming platform, instead of ripping off
> someone else's copyrighted work like the Soviets did. Maybe you can
> say that I am trying to implement communism properly, because the
> actual communists are so inept.
Please don't bring politics into the discussion here.
>
> Regardless, there is a voice in my head telling me that C90 is the
> key to the universe, and that I should focus on that before moving on
> and endlessly chasing the latest fad.
>
> How many lines of C90 code would be required to write a C90 compiler
> that outputs 80386 assembler? I think we should be holding
> international competitions to try to get that number down to a
> minimum. Maybe. I'm not sure what is required, but I'm trying to see
> if I can collapse the universe, to see what happens next.
>
As always, if you think this if fun - go for it. You might find other
people who think such a competition would be fun. But don't imagine you
are doing anything useful beyond the fun.
You are not the first person to want to re-invent computing, or write
everything from scratch, based on voices in your head. Some people want
to go back to their imagined "golden age", some people think that they
alone know the best way to make a programming language, or OS, or
computer. My advice is the same:
Don't take yourself or your project too seriously.
Don't expect anyone else to take it seriously.
Don't get too ambitious - do one thing at a time, or you will not finish
anything.
Don't rely on building a community to work together - expect to be on
your own with this.
Don't neglect the rest of your life, work, and people around you.
Enjoy yourself!