[fpc-pascal] Warning: Variable xxx does not seem to be initialized

Marcos Douglas md at delfire.net
Tue Dec 31 21:47:57 CET 2013

On Tue, Dec 31, 2013 at 6:18 PM, Sven Barth <pascaldragon at googlemail.com> wrote:
> On 31.12.2013 15:06, Marcos Douglas wrote:
>> On Mon, Dec 30, 2013 at 9:38 PM, Sven Barth <pascaldragon at googlemail.com>
>> wrote:
>>> Am 30.12.2013 20:08 schrieb "Marcos Douglas" <md at delfire.net>:
>>>> Hi,
>>>> I'm using FPC 2.6.2 and {advancedrecords}.
>>>> The compiler shows a warning when I use a record variable. IMO this is
>>>> a bug because record variables need not be initialized, right?
>>> Managed types (strings, interfaces, dynamic arrays) inside a record will
>>> have a valid value (Nil), but other values will he garbage. The compiler
>>> does not check whether a record contains any non-managed fields before
>>> generating the warning.
>> Ok. But is this will be "corrected" in the next version? Because if
>> won't, I can not see sense to use it.
> It seems that this was already corrected at least in trunk as a test with
> 2.7.1 does not show a warning anymore. I don't know whether the
> corresponding fix was merged to 2.6.3 though (I assume "no" by default for
> compiler changes though).

If was corrected in 2.7.1 is enough for me.

>> The structure that does same but does not have this problem is the
>> object type. But is it used yet? I think Delphi make it deprecated,
>> right?
> What do you mean "But is it used yet?"?

Is recommended to use it or FPC team recommends to use "record" instead?

> And yes, Borland, Codegear,
> Embarcadero, whoever decided that "object" is deprecated in Delphi in FPC
> however they are still fully working and also benefit from newer features
> here and then (mostly because "object" shares a lot of code with "class" and
> "interface").

So, maybe is more useful to use object type instead record type to
group functions.

Marcos Douglas

More information about the fpc-pascal mailing list