Did you try this and compare the compilation-result wth fpc /Delphi of this?
Nope, and won't bother. There is nothing interesting for me in it.
Whan a child goes out of the house first time and sees the very first streetin his life - counting houses is interesting. So is counting floors in houses, windows. It is first time information gathering.
But after you saw a dozen or so streets it is no mor interesting. You got idea what is street, what is house, what kind of houses are there and are not. Now regular streets and houses are no more thrilling.
Let's go into that street A and count houses there! It would be different from streets B and street C. Well, no, just no. Yes, different. No, not thrilling.
program cadena;
Frase: String;
WriteLn(Frase[500]);
This should be dependent on the Boundary Checking option ( {$B+{ if i remember, maybe not)
You essentially just wrote
var Frase: array [0..255] of byte;
begin
Frase[500]
end;
You obviously try to read outside boundaries of array.
What it would lead to?
Well, maybe compiler would detect it and prohibit it before running.
Maybe compiler would let it go, but in the runtime there would be hidden code to check boundaries and it would through array boundary error.
Then, depending on settings, this can be done TurboPascal way ( calling RunError( NNN ), writing the error to terminal and halting the program altogether), or Delphi way (througing exception EBoundsError or something, but not terminating program)
Maybe compiler would not bother at all, and you would read some random memory cell outside the array. Then what?
If the operating system has memory protection and the array was the last variable, then you ould be reading virtual memory that does not even exist. Then operating system would claim General Protection Fault, or Access Violation, or SegFault signal or whatever OS designers decided to name the error, and OS would kill the program. Do i want to know what name was chosen for it in your OS? No. It is not important.
If the operating system workd with real memory, or there is no operating system at all, or there are many more variables after that array - then what? they you would read out the memory of some other variable instead of array.
There specific route of those would mostly be dependent on compiler settings, including compile-time checks enabled, runtime checks enabled and tunrime operating system.
Am i thrilled to know which set of compiler options you set on your machine? No more than counting houses in the street you live. That is just a random number
with no special importance.
IF you are thrileld ot learn it - i am hapyp for you. Enjoy this discovery. Delphi RTL sources, FPC RTL souces, assmebler-level debugging your program - it all can be very inspiring.
https://stackoverflow.com/questions/1194339/delphi-strings-in-records-bigger-than-255-charshttps://word-sentences.com/code-examples/delphi-strings-in-records-bigger-than-255-chars/https://docwiki.embarcadero.com/RADStudio/Sydney/en/String_Types_(Delphi)
It surely is thrilling when you dive into it first time - but only if you have a knack for low-level close-to-metal coding. If you do - start your adventure. If you do not - jsut ignor the clues.