Re: Coding styles


Ashhar Farhan
 

C88? That was a very very long long ago... I remember ads for it, probably it was in Dr.Dobbs?
- f


On Mon, 7 May 2018, 21:57 Mark Pilant, <mark@...> wrote:
My number 1 rule about coding is:
     Expect / assume someone else will have to modify or maintain the
     code being written.  This means: *comment* the code.

I can't tell you how much I *hate* the statement "the code is the
comments".  Even the code I write for myself, I still put in lots of
comments.  Having them makes it soooo much easier later on when I need
to make changes.

My number 2 rule about coding is:
     Use the same coding style of the existing code when making changes.
     Trying to follow and understand code written using different coding
     styles can be really hard, and lead to misunderstanding and errors.

Probably the best example I have is one piece of assembly code I wrote
years ago.  The code itself was only about 25-30 lines of assembly code,
but there was another page of comments explaining how the code actually
worked because there was a lot of bit manipulation and "odd" instructions
because they were faster than the expected instruction.   (This was the
main protection checking function in the OpenVMS kernel [dating myself]
if anyone is wondering, and it had to be really fast.)

73

- Mark  N1VQW




Join BITX20@groups.io to automatically receive all group messages.