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