Lazarus

Using the Lazarus IDE => Editor => Topic started by: BeniBela on November 19, 2020, 02:28:08 pm

Title: default integer type for codetools
Post by: BeniBela on November 19, 2020, 02:28:08 pm
When you write something like
Code: Pascal  [Select][+][-]
  1. i := 0
or
Code: Pascal  [Select][+][-]
  1. for i := 1 to length(something) do  
and press ctrl+shift+C, Lazarus adds
Code: Pascal  [Select][+][-]
  1. var  i: Integer;
which is often wrong on 64-bit system.

How do you set it to always complete it to:

Code: Pascal  [Select][+][-]
  1. var  i: SizeInt;

Title: Re: default integer type for codetools
Post by: lucamar on November 19, 2020, 02:43:56 pm
I don't think you can. After analizing the line Lazarus always "completes" to the closest, more generic type it can find which in this case is Integer, just as with strings it always completes to generic String rather that using Short- or AnsiString.
Title: Re: default integer type for codetools
Post by: BeniBela on November 22, 2020, 12:03:13 pm
But integer is  neither the closest (that would be byte or shortint) nor the most generic (which would be sizeint)

Even if there is no config option, there should be at least a line in the code where it can be patched
Title: Re: default integer type for codetools
Post by: lucamar on November 22, 2020, 01:40:33 pm
But integer is  neither the closest (that would be byte or shortint) nor the most generic (which would be sizeint)

Even if there is no config option, there should be at least a line in the code where it can be patched

Maybe "closest" was not the right term; I meant "basest", as in "the more general type". For reals, for example, it completes "i := 0.8" by adding "i: Extended".

But I might be completely wrong. If you want to know exactly what it's doing your best bet is to dive into the sources and, maybe, build a patch to allow it to be configurable.
TinyPortal © 2005-2018