Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/18/05 19:48
Read: times


 
#85221 - comments
Responding to: ???'s previous message
I agree -- Jan's comments really aren't comments. The person who can't figure out that
++dest;
means "increment destination pointer" shouldn't be working as a programmer.

The thread about hooking SDRAM up to an 8051 made me go back and look at some Verilog for an SDRAM controller that I'd written a couple of years ago. (Verilog has all of C's problems, as well as some interesting ones of its own.) Because this SDRAM controller is tightly integrated into a DMA controller and a PCI target controller, it's not very straightforward. There are a bunch of assignments that are simply written:
assign WriteOutputFIFO = 
 ((isTrgtMem && user_rdwr && user_mult && ~TrgtEndOfRow) ||
  (isTxDma && ~xfpf_latch && ~TxEndOfRow);

Above this tough-to-parse assignment is a detailed, twenty-line comment explaining the logic behind the logic. There's no way I'd remember why I wrote this the way I did, and the documentation above the assignment details the conditions expected, as well as how the signal will be used in other parts of the module.

Finally, code can be self-documenting. Rather than calling a variable i or cnt or some such, give it a real name: TargetAddress or LoopCount or something. It's not FORTRAN here and we're not limited to eight significant characters!

-a

List of 36 messages in thread
TopicAuthorDate
simple serial programs examples            01/01/70 00:00      
   Hello, World            01/01/70 00:00      
      Well, yes but            01/01/70 00:00      
         very basic            01/01/70 00:00      
            My point            01/01/70 00:00      
               basic            01/01/70 00:00      
                  but...            01/01/70 00:00      
         Dear oh dear            01/01/70 00:00      
            Impossible!            01/01/70 00:00      
               Avoiding mistakes            01/01/70 00:00      
                  'C' - the sloppy programmers choice            01/01/70 00:00      
                     bloatware in Pascal, too!            01/01/70 00:00      
                        Go on then....            01/01/70 00:00      
                     Horrible C            01/01/70 00:00      
                        Horrible programmer            01/01/70 00:00      
                           If that's you...            01/01/70 00:00      
                     Author, not the language            01/01/70 00:00      
                        Caveat            01/01/70 00:00      
                        language wars            01/01/70 00:00      
                           Bloat or bugs            01/01/70 00:00      
                        singer, not the song            01/01/70 00:00      
                           verbosit/clarity            01/01/70 00:00      
                              Poor, deluded hackers...            01/01/70 00:00      
                              Commented! :-)            01/01/70 00:00      
                                 re commented            01/01/70 00:00      
                                    Comments good and evil            01/01/70 00:00      
                                    comments            01/01/70 00:00      
                                    A quote from some wise people            01/01/70 00:00      
                                       Good but...            01/01/70 00:00      
                                          why...            01/01/70 00:00      
                                             Very true            01/01/70 00:00      
                                                been there, done that            01/01/70 00:00      
                                    Correct comments :-)            01/01/70 00:00      
                                       fishing in Minnesota            01/01/70 00:00      
                                 Author, not the language            01/01/70 00:00      
                                    bounds checks, error testing, comments            01/01/70 00:00      

Back to Subject List