LWN.net Logo

Advertisement

Front, Kernel, Security, Distributions, Development. See your byline here on LWN.net.

Advertise here

21 of the Best Free Linux Text Editors (LinuxLinks)

21 of the Best Free Linux Text Editors (LinuxLinks)

Posted Aug 29, 2008 19:05 UTC (Fri) by jzbiciak (✭ supporter ✭, #5246)
In reply to: 21 of the Best Free Linux Text Editors (LinuxLinks) by pr1268
Parent article: 21 of the Best Free Linux Text Editors (LinuxLinks)

Agreed. I have one idiom I picked up from a friend in school which I've found rather helpful over the years. I put temporary debug code in column 0, to make it stand out from the program. Example:

    iv->smp_cursum = 0;
    iv->smp_totsmp = 0;
    if (iv->smp_file)
    {
        fwrite(wav_hdr, 1, sizeof(wav_hdr), iv->smp_file);
jzp_printf("starting sample: %s\n", iv->smp_cname); jzp_flush();
    }

It makes the debug code easier to find and delete later, and it makes it clear to the reader "This isn't part of the normal flow." Of course, this won't work if the editor (or language) enforces indentation.

Back in my high school years, I used to program QBASIC, among other things. One of the things that always drove me nuts about it is that it insisted on normalizing the white space within a line. I personally like to line things up to make my code look more tabular. Here's an example from my "last" QBASIC program, a cartridge dumper driven via the parallel port under Win9x:

                                   '   BC1  BC2  BDIR
NACT = 0                           '    L    L     L
BAR = BDIR                         '    L    L     H
IAB = BC2                          '    L    H     L
DWS = BC2 + BDIR                   '    L    H     H
ADAR = BC1                         '    H    L     L
DW = BC1 + BDIR                    '    H    L     H
DTB = BC1 + BC2                    '    H    H     L
INTAK = BC1 + BC2 + BDIR           '    H    H     H

I would have preferred to format that like so:

                                   '   BC1  BC2  BDIR
NACT  = 0                          '    L    L     L
BAR   = BDIR                       '    L    L     H
IAB   = BC2                        '    L    H     L
DWS   = BC2 + BDIR                 '    L    H     H
ADAR  = BC1                        '    H    L     L
DW    = BC1 + BDIR                 '    H    L     H
DTB   = BC1 + BC2                  '    H    H     L
INTAK = BC1 + BC2 + BDIR           '    H    H     H

...or maybe...

                                   '   BC1  BC2  BDIR
NACT  = 0                          '    L    L     L
BAR   =             BDIR           '    L    L     H
IAB   =       BC2                  '    L    H     L
DWS   =       BC2 + BDIR           '    L    H     H
ADAR  = BC1                        '    H    L     L
DW    = BC1 +       BDIR           '    H    L     H
DTB   = BC1 + BC2                  '    H    H     L
INTAK = BC1 + BC2 + BDIR           '    H    H     H

(And no, I didn't write that code in high school. It was embarrassingly more recent than that. It was just easier to drive the parallel port directly from QBASIC than it was to figure out how to do it from C in user space. Plus, I had access to a Win98 laptop, so it worked out pretty well.)


(Log in to post comments)

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds