C (was: The iAPX 432 and block languages)

Fred Cisin cisin at xenosoft.com
Tue Apr 11 19:08:57 CDT 2017


On Tue, 11 Apr 2017, Jecel Assumpcao Jr. via cctalk wrote:
> These are all very good points. I agree I was exagerating by saying the
> iAPX432 and 8086 couldn't run C.

Or were you implying that nothing worthwhile has ever been written for 
80x86 (in ANY language?)?   That would be harder to argue with.

C's greatest weakness, and C's greatest strength, is that it lets you do 
things that you shouldn't.  (Such as putting a pointer into an int, etc.)

As Holub titled one of his books, C gives you "enough rope to shoot 
yourself in the foot".


If you stick to only doing things "the way that you are supposed to", then 
C code is actually pretty portable.  But what's the fun in THAT?

You have to take full responsibility for what you do with C.
It is YOUR responsibility to decide what casts are safe to do.
It is YOUR responsibility to put in all runtime error checking -
if you don't check every denominator for a zero value, then any
resulting black holes are YOUR responsibility.

If you are sure that nothing can ever be out of range, then you can save 
object code by not putting in runtime error checking.
The problem is, of course, that too many people are "sure", that shouldn't 
be.  Hence, you get an amazing amount of software that can never be truly 
reliable.
For example, if you know for sure that no file will ever be larger than 
2GB, then you can get away with using a signed 32 bit "long" int for file 
size, or simply printf("%ld", FILESIZE) for displaying it.  (Try using a 
sector editor (such as DEBUG) and changing the last 4 bytes of a DOS 
Directory entry to FFFF FFFFh.)


I am, of course, embarrassed by the quality of most of the code that I 
have ever written.


--
Grumpy Ol' Fred     		cisin at xenosoft.com



More information about the cctalk mailing list