Re: Compiler warnings

w7hd.rh <w7hd.rh@...>

How this brings back memories.  I learned C on a Unix V7 machine (PDP-11/45) using the original Bell Labs code.  I was working for Pacific Northwest Bell at the time and wrote most of the automated data-gathering code in C for remote sites all over Oregon, Washington and Idaho.  Since the code ran in the wee hours of the morning, it had to be fast to gather and compile all the data for all those sites, so brevity was key there.
Then I went on to learn Pascal at Oregon Heath & Sciences center.  When I finally got my own personal computer in 1977, I used Whitesmiths C compiler on a Z80 based MP/M system.  Wrote a satellite-tracking program for our ham club and had great fun re-learning Solid Geometry.

Ron W7HD

On 07/02/2018 07:46 PM, ajparent1/KB1GMX wrote:
I like your rules Jack.

My standard for a function or any subroutine is simple do one thing.
I guess that matches your no swiss knives.  I call them overloaded functions.

I think the best example of that is the SD library as it drags in FAT.  Its huge 
and if all you want to do is read or write blocks FAT is not needed or even
a file system.  Or you can just do tag and bag directory and teach the PC 
to use a simpler system to talk to a block device.  That is only one example.
Took me a while to tear the whole thing down to block_Write(blockNum, Buffer)
and block_read(blockNum, Buffer)  Where buffer is a 512 byte area, and
blockNum is a 32bit int.  The difference is more than 10K of code!

Global variables are ok if used for that only.  Not be cause the tuning math
needed a variable to store and intermediate result.

The offense i've seen is long ints when the counter never exceeds maybe 10
and floats when the value is going to be an integer.   Its remarkable that
people forget the iron they are programing is basically a 8 bit byte machine.

C and for that fact C++ is a small language, the libraries are where people
get their shorts eaten.  You don't need a full string library for a little 8bitter.

C seems to be there when others have come and gone.  Just about all the
others are easy (Ruby, Python, Java) if you know C.

A a long time PDP11 user (I have Unix V2.11 and Ultrix V6(BSD flavor).
ITs funny to thing the 11 is a near native C machine (very CISIC) and
the origin point for C and typically 128K bytes was a big machine. 
It teaches one brevity, modularity, and with care clarity.  

I still use Small-c on many micros because it is C (more K&R than ansi but hey
it was the 70s and ANSI was over a decade later) and small.    I like it because
it allows me to get as close to the irn as I care to and yet hide the iron when I
need to. 


Ron W7HD - NAQCC#7587 OMISS#9898 KX3#6966 LinuxUser#415320
Editor OVARC newsletter

Join to automatically receive all group messages.