procedure Initialize( |
var T: TAnyManagedType; |
ACount: SizeInt (https://www.freepascal.org/docs-html/rtl/system/sizeint.html) = 1 |
); |
4194304 0 0 0 1 0 503 0 41120 1
===========================================
0 0 0 0 0 0 0 0 0 0
Q1: I believe local variables are not initialised.
see https://www.freepascal.org/docs-html/ref/refse24.html
i.e. Local variables are on the stack, which is reused repeatedly hence might contain stale data.Well,
Global variables might (depending on implementation details) be in a separate global space or might get the first bit of stack.
In the general case, it might be best not to assume that this is initialised: a great deal depends on the language implementation, the linker, and the behaviour of the OS when it allocates and loads initial memory.
MarkMLl
Do you have a link to such issue? Or know the reason of wont fix?As far as I know, mostly from FPK, Jonas and PascalDragon, the reason is that it is simply too complex to fix and work-arounds exist.
2. with the default memory manager heap memory, globals are always initialized
3. when you use a different memory manager that may not be the case.
@PascalDragon, I would love to have your answers on the questions.
The docs could have been more specific about Initialize and Finalize applying to managed variable types only.
For instance the pseudo signature could have been given as:
procedure Initialize( var T: TAnyManagedType; ACount: SizeInt (https://www.freepascal.org/docs-html/rtl/system/sizeint.html) = 1 );
If the use didn't Initialize the value, eg V: Integer, I agree that the hint is required. But for a managed type that has Initialize operator, and FPC inserts code for Initialize, so it is clearly Initialized, then warning is redundant.
If there is a issue, I can check on that, or I can open one.
A page like this in the FPC documentation would be useful. Improving the documentation would greatly help people who are just starting to program in Pascal and Object Pascal using PFC (whether or not they have programmed anything before). I myself once had the understanding of how these subroutines work. Among other things, such trifles significantly affect the popularity of the language. And that's what we care about.
A page like this in the FPC documentation would be useful. Improving the documentation would greatly help people who are just starting to program in Pascal and Object Pascal using PFC (whether or not they have programmed anything before). I myself once had the understanding of how these subroutines work. Among other things, such trifles significantly affect the popularity of the language. And that's what we care about.
Then please report an issue for the documentation. It doesn't help if you say that things should be improved, the right people need to know about something being amiss.
It is in the left menu and called bugtracker.
https://gitlab.com/freepascal.org/fpc/source/-/issues
While your at it consult your eye specialist.. :o
A page like this in the FPC documentation would be useful. Improving the documentation would greatly help people who are just starting to program in Pascal and Object Pascal using PFC (whether or not they have programmed anything before). I myself once had the understanding of how these subroutines work. Among other things, such trifles significantly affect the popularity of the language. And that's what we care about.
Then please report an issue for the documentation. It doesn't help if you say that things should be improved, the right people need to know about something being amiss.
geriatric specialist :)Yes I know I turned 65 this week, but average age according to my genes and family heritage is 90+ 8-)
...I turned 65 this week, but average age according to my genes and family heritage is 90+ 8-)
Yes I know I turned 65 this week, but average age according to my genes and family heritage is 90+ 8-)
Anyway, thanks for the congratulations, I know you mean that! :D