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

Sven Barth pascaldragon at googlemail.com
Tue Dec 31 22:53:36 CET 2013


On 31.12.2013 21:47, Marcos Douglas wrote:
>>> 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?

The methods for records were introduced for Delphi compatibility, so 
they are rather young compared to objects (which are still used here and 
then inside the compiler for example, because most code is from a time 
when records could not have methods). In contrast to objects they 
however provide support for operator overloads (you need to use these if 
you want to use overloaded operators inside a generic) and they can have 
a variant part. Objects however support inheritance if the need arises.

>> 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.

Depends on the use case and preference. See above.

Regards,
Sven



More information about the fpc-pascal mailing list