[Lazarus] Extending TRect breaks Lazarus

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Nov 7 12:01:28 CET 2015


On Sat, 7 Nov 2015 11:39:44 +0100
Jürgen Hestermann <juergen.hestermann at gmx.de> wrote:

>[...]
> CodeTools do not help you *read* the code.

It can help you writing the code more readable and helps to read (i.e.
understand) the code by hints and find declaration.

 
>[...]
> -----------------------------
> with PathArray[High(PathArray)]^ do
>     fillchar(StatisticOfFiles,sizeof(StatisticOfFiles),0);
> -----------------------------
> 
> instead of this:
> 
> -----------------------------
> fillchar(PathArray[High(PathArray)]^.StatisticOfFiles,sizeof(PathArray[High(PathArray)]^.StatisticOfFiles),0);
> -----------------------------

An one liner with only one used variable is a pretty safe 'with' and
is mostly a matter of taste.

But a complicated expression like PathArray[High(PathArray)]^ can be
made more readable (easier to understand) like this:

LastPath:=PathArray[High(PathArray)];
fillchar(LastPath^.StatisticOfFiles,sizeof(LastPath^.StatisticOfFiles),0);

Use Ctrl+Shift+C on LastPath to create the pointer variable.

Mattias




More information about the Lazarus mailing list