Re: hardware errors, do C and Forth need different things in hardware?



Jeff Fox wrote:
These are ways Forth can beat C because C wants to
insist that one needs mainframe hardware and software.
That's the problem it was designed to sovle, to write
Unix as the software traffic cop for the hardware traffic
cop for hostile C programs.

C doesn't insist on anything.

Back a couple years ago, you wrote one of your typically leading messages asking about the executable size of a simple "Hello World" program in C. I happened to be working with a C compiler for microcontroller at the time (ImageCraft's HC08), and so I compiled some code to see the size. The result was around a couple hundred bytes, assuming one used puts to display the string instead of the overkill printf that's in most canonical examples. A minimal printf shot the size to about 1800 bytes. And in either case, that was the *entire* code, including startup and the vector to allow the processor to run the program. There was no OS on the target. This was code that talked to the bare metal.

Your reply at the time was "nice."

I really get tired of your apples-to-oranges comparisons. When talking about Forth, you have both feet planted firmly in the embedded systems space. You talk about systems that aren't general purpose, but are designed to be specific in what they do. And the company you now work for sells chips that are designed for specific functions, not for general-purpose computing.

So that's where you start, but for some reason the second you begin talking about C, you move the discussion somewhere else entirely. It doesn't matter that the vast array of micros being used in embedded systems don't have any operating system on the target. It doesn't matter that the majority of these are programmed in C with code that talks to the bare metal. It doesn't matter that the size of many of these systems doesn't even allow for a minimal operating system. It doesn't matter that for years, magazines that target the embedded systems community have talked about commonly-used techniques in C for using various models of cooperative multitasking (round robin task lists, message passing, a variety of state machine models, etc.).

None of that (and much more) matters to you. To you, C programmers have a "mindset" that forces them to require an operating system on the target, and write code that is far above the bare metal.

The problem is that you know better-- you have to know better-- but if you talked about C programmers who target embedded systems then your rants wouldn't work.

The thing is, you're right when you're talking outside the embedded systems space. C programmers writing code for general-purpose systems do expect an operating system to both provide services and to abstract away the underlying machine for portability. But that's not C for embedded systems-- supposedly what you're talking about.

The first reads BEGIN AGAIN. All Forth programmers are
suppose to be able to read that. It is suppose to be simple.
It does not imply hidden background tasks or watchdogs.
Thinking it is dozens of times more complicated than it
is misses the power of Forth and is an error. It isn't C.

do {
} while(1);

I don't see a bug there. I don't see a hidden background task.

What makes Forth fundamentally different than C and
gives it some fundamental advantages over C is that
it can do things with much less overhead than C. That
is because in C the idea is that software is bad and
an OS and hardware traps are needed to protect
everything from bad software. Bugs are planned, and
the whole picture is all about the planning for bugs.

Give a concrete example. I will code in C, and then show you the assembly code generated. You won't see anything in the assembly code that is unexpected, no reliance on an OS, no hardware traps needed to protect anything.
.



Relevant Pages

  • Re: hardware errors, do C and Forth need different things in hardware?
    ... I am talking about C programmers who target embedded systems. ... nothing to do with that class of hardware. ... Jeff starts with that context when talking about Forth ...
    (comp.lang.forth)
  • Re: !p+, and thank you Jeff
    ... traditional Forth programmers, ... It is why our hardware can be simpler and our software can ... It was fun trying to write small and fast ... ANS Forth looks the way it does is because of Pentium ...
    (comp.lang.forth)
  • Re: Sound after upgrade to 11.1
    ... And many people have no problem with sound -- whereas ... I've been using SUSE since 7.0 and have heard the same complaints at ... to strenuously test their OS on *every possible combination of hardware ... There are thousands of programmers working on the kernel and all the ...
    (alt.os.linux.suse)
  • Re: Sound after upgrade to 11.1
    ... I've been using SUSE since 7.0 and have heard the same complaints at ... of hardware available*. ... There are thousands of programmers working on the kernel and all the ... Linux is *still* a largely volunteer environment. ...
    (alt.os.linux.suse)
  • Re: hardware errors, do C and Forth need different things in hardware?
    ... you have insisted that C programmers include the size of the operating system and any libraries in with the size of their program. ... Your original question was based on your continued misunderstanding of the differences between C programmers targeting operating systems and C programmers targeting embedded systems. ... I say it is not general purpose hardware. ... If that is a bug then C is a bug. ...
    (comp.lang.forth)