Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss] OT Rant/Discussion C vs C++

On 12/16/2012 08:12 AM, dan at wrote:
>> ...                                   Whenever you get into code
>> maintenance, you get to see why it is important to write relatively
>> clear and concise code.
> Brian Kernighan would (did) agree:
>   Everyone knows that debugging is twice as hard as writing a program
>   in the first place.  So if you're as clever as you can be when
>   you write it, how will you ever debug it?
>      Kernighan BW & Plauger PJ: _The Elements of Programming Style_
I learned the hard way in graduate school. I wrote an assembler program
on a PDP-8, then broke for finals. After finals I came back and could
not understand what I had written. That made me a beliver in placing
comments in the code (and updating comments when you changed the code).
Sometimes, you need to write clever code because of the requirements. In
PDP-8, to keep a driver at 1 page(1 memory page), we used as many tricks
as we could. Subroutine entries were single word dead spaces until you
enter the subroutine, which then were used as the return address. If you
were not in that subroutine, you could cheat and use that word as
scratch. Secondly, if you needed a mask, you could use an  existing word
or instruction as a mask therefore saving a word. So, whenever I write
code whether bash scrips, tcl/tk, Python, C or C++ I try to write it so
that someone else can easily figure it out. Meaningful names for
functions or classes, and I try to organize the code in a meaningful way,
Some of the worst code I have seen was COBOL. From a banking system
originally written in IBM assembler converted to Burroughs COBOL, a
COBOL system written by a Fortran programmer who hated COBOL, and some
cases of some highly non-portable code written in Burroughs COBOL that
did not translate at all to IBM COBOL. Interestingly the YACC and Lex
code in Unix was not too bad, but adding a modern feature to lex was

Jerry Feldman <gaf at>
Boston Linux and Unix
PGP key id:3BC1EB90 
PGP Key fingerprint: 49E2 C52A FC5A A31F 8D66  C0AF 7CEA 30FC 3BC1 EB90

BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!

Boston Linux & Unix /