[Lazarus] clarification / Re: constant-highlight ? [Re: quick opinion poll / pascal highlighting "case"]

Graeme Geldenhuys graemeg.lists at gmail.com
Sat May 29 17:20:23 CEST 2010


On 29 May 2010 17:08, Henry Vermaak wrote:
>
> This is why I don't put blocks of comments after code.  Imho
> multi-line comments belong on their own lines, otherwise it messes up
> the way I read code.  You're also more likely to exceed 80 chars width

A very common case where comments are used after code is in file
structures and header translation.

Where is a simple example, and I have lots more like it. For my normal
(hand-written from the start) code I normally don't do this style of
formatting though.

------------------------------
  TExtendedHelpFileHeader = packed record
    NumFontEntry: uint16;             // FONT TABLE:   Number entries
    FontTableOffset: uint32;          // FONT TABLE:   Offset in file
    NumDataBase: uint16;              // DATA BASE:    Number of files
    DataBaseOffset: uint32;           // DATA BASE:    Offset in file
    DataBaseSize: uint32;             // DATA BASE:    Size in bytes
    EntryInGNameTable: uint16;        // GLOBAL NAMES: Number entries
    HelpPanelGNameTblOffset: uint32;  // GLOBAL NAMES: Offset in file
    StringsOffset: uint32;            // STRINGS : Offset in file
    StringsSize: uint16;              // STRINGS : Total bytes of all strings
    ChildPagesOffset: uint32;         // CHILDPAGES : Offset in file
    ChildPagesSize: uint32;           // CHILDPAGES : Total bytes of all strings
    NumGIndexEntry: uint32;           // Total number of Global Index items
    CtrlOffset: uint32;               // CTRL BUTTONS : offset in file
    CtrlSize: uint32;                 // CTRL BUTTONS : size in bytes
    Reserved: array[0..3] of uint32;  // For future use. Set to zero
  end;
  TPExtendedHelpFileHeader = ^TExtendedHelpFileHeader;
------------------------------


> if you do this.  Personal preference, of course  The elastic tab stops
> are clever, but you are limiting yourself to editors that support
> them.

A rather weak statement I think. 99.9% of developers probably use 1
editor (ide) for a specific language. How often do developers
developing LCL based applications switch to another editor (instead of
Lazarus IDE)? Probably never. For that other 0.1% they probably only
use 2 editors max. For those editors that don't support ET, there
indentation should look fine, but trailing comments (alignment) might
not. Code should still be very readable though.


-- 
Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/




More information about the Lazarus mailing list