Recent

Author Topic: Question on Compiler Warnings  (Read 883 times)

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Question on Compiler Warnings
« on: December 07, 2019, 09:06:49 pm »
unit1.pas(413,24) Warning: Local variable "RCDL" of a managed type does not seem to be initialized

I get the above Warning all the the time on records RCDL is a record.

What does this mean?

Thanks
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

jamie

  • Hero Member
  • *****
  • Posts: 6091
Re: Question on Compiler Warnings
« Reply #1 on: December 07, 2019, 10:53:22 pm »
Not sure but are you using "Strings" inside the record ? Or maybe some class or something that the compiler see's no code of accessing it.

 Also at one time but I don't think I applies much anymore was if you use managed strings in the record you had to use Initialize and Finalize at the start and end of the records use. That would query the record and managed any manageable types within the record.

 But I am guessing that isn't the case, you could even be using dynamic arrays..

The only true wisdom is knowing you know nothing

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Question on Compiler Warnings
« Reply #2 on: December 07, 2019, 11:00:34 pm »
Hi!

If you don't initialize a record like

Code: Pascal  [Select][+][-]
  1. RCDL.MyString := 'Good morning';

but you do it like
Code: Pascal  [Select][+][-]
  1.  
  2. InitializeRCDL( RCDL);

then the compiler does not recognize that the variable is initialized and emits the warning.
Disable this warning. It's only confusing.

Winni
« Last Edit: December 07, 2019, 11:22:08 pm by winni »

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Question on Compiler Warnings
« Reply #3 on: December 08, 2019, 12:52:27 am »
Then Record I'm Using is made up of all string.

Thank you;
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

 

TinyPortal © 2005-2018