Just to test my understanding, in this construction:
The first thing to understand is that the way that construction is implemented depends on the setting of $LONGSTRINGS.
consider the following very simple test program (using your array):
{$APPTYPE CONSOLE}
{$LONGSTRINGS ON}
//{$LONGSTRINGS OFF}
program _PascalArrayOfStrings;
uses
Windows,
sysutils
;
const
DTFmt: array[0..11] of string =
('',
'yyyy-mm-dd hh:nn', 'yyyy-mm-dd', 'yyyy-mm-dd', {ISO formats}
'dddddd tt', 'dddddd', 'tt', {Long formats}
'ddddd t', 'ddddd', 't', {Short formats}
'f', {Mixed short date + long time}
'');
var
i : integer;
begin
for i := low(DtFmt) to high(DtFmt) do
begin
writeln(DtFmt[i]);
end;
writeln('press <enter>/<return> to end this program');
readln;
end.
The implementation and behavior is radically different depending on the setting of LONGSTRINGS.
Here is what happens when LONGSTRINGS is OFF
PascalArrayOfStrings.lpr:32 writeln(DtFmt[i]);
00401563 e8b89c0000 call 0x40b220 <fpc_get_output>
00401568 89c3 mov %eax,%ebx
0040156A a100804100 mov 0x418000,%eax ; load i into eax
0040156F c1e008 shl $0x8,%eax ; multiply by 256 (sizeof(shortstring))
00401572 8d8880304100 lea 0x413080(%eax),%ecx ; load address of string into ecx
00401578 89da mov %ebx,%edx ; the rest is writeln stuff
0040157A b800000000 mov $0x0,%eax
0040157F e87c9e0000 call 0x40b400 <fpc_write_text_shortstr>
00401584 e8076f0000 call 0x408490 <fpc_iocheck>
00401589 89d8 mov %ebx,%eax
0040158B e8d09d0000 call 0x40b360 <fpc_writeln_end>
00401590 e8fb6e0000 call 0x408490 <fpc_iocheck>
00401595 833d008041000b cmpl $0xb,0x418000
0040159C 7cbe jl 0x40155c <main+28>
In that case the following is true:
1. there is no array of pointers pointing to individual strings
2. strings are in a READ/WRITE section of the executable, therefore they can be modified.
3. a '' string has 256 bytes reserved in the READ/WRITE section it resides in. (therefore it can be changed)
Here is what happens for the very same array when LONGSTRINGS is on:
v '' string
0x00000001000150D0 0000000000000000 0000000100017018 .........p......
0x00000001000150E0 0000000100017048 0000000100017070 Hp......pp......
0x00000001000150F0 0000000100017098 00000001000170c0 ˜p......Àp......
0x0000000100015100 00000001000170e0 0000000100017100 àp.......q......
0x0000000100015110 0000000100017120 0000000100017140 q......@q......
0x0000000100015120 0000000100017160 0000000000000000 `q..............
^ '' string
0x0000000100015130 000000010001f060 0001f07000000008 `ð..........pð..
0x0000000100015140 0000038000000001 000000010001f400 ....€....ô......
0x0000000100015150 0001f79000000380 0000038000000001 €....÷......€...
The following is true in that case:
1. there is an array of pointers (to null terminated strings)
2. a '' is simply a null pointer
for reference, note the address of the array of pointers, address 0x1000150D0
Following the pointers in the array, shows
0x0000000100017018 79 79 79 79 2d 6d 6d 2d 64 64 20 68 yyyy-mm-dd h
0x0000000100017024 68 3a 6e 6e 00 00 00 00 00 00 00 00 h:nn........
0x0000000100017030 00 00 01 00 00 00 00 00 ff ff ff ff ........ÿÿÿÿ
0x000000010001703C ff ff ff ff 0a 00 00 00 00 00 00 00 ÿÿÿÿ........
0x0000000100017048 79 79 79 79 2d 6d 6d 2d 64 64 00 00 yyyy-mm-dd..
0x0000000100017054 00 00 00 00 00 00 01 00 00 00 00 00 ............
0x0000000100017060 ff ff ff ff ff ff ff ff 0a 00 00 00 ÿÿÿÿÿÿÿÿ....
0x000000010001706C 00 00 00 00 79 79 79 79 2d 6d 6d 2d ....yyyy-mm-
0x0000000100017078 64 64 00 00 00 00 00 00 00 00 01 00 dd..........
0x0000000100017084 00 00 00 00 ff ff ff ff ff ff ff ff ....ÿÿÿÿÿÿÿÿ
0x0000000100017090 09 00 00 00 00 00 00 00 64 64 64 64 ........dddd
0x000000010001709C 64 64 20 74 74 00 00 00 00 00 00 00 dd tt.......
0x00000001000170A8 00 00 01 00 00 00 00 00 ff ff ff ff ........ÿÿÿÿ
0x00000001000170B4 ff ff ff ff 06 00 00 00 00 00 00 00 ÿÿÿÿ........
0x00000001000170C0 64 64 64 64 64 64 00 00 00 00 01 00 dddddd......
0x00000001000170CC 00 00 00 00 ff ff ff ff ff ff ff ff ....ÿÿÿÿÿÿÿÿ
0x00000001000170D8 02 00 00 00 00 00 00 00 74 74 00 00 ........tt..
0x00000001000170E4 00 00 00 00 00 00 01 00 00 00 00 00 ............
0x00000001000170F0 ff ff ff ff ff ff ff ff 07 00 00 00 ÿÿÿÿÿÿÿÿ....
0x00000001000170FC 00 00 00 00 64 64 64 64 64 20 74 00 ....ddddd t.
0x0000000100017108 00 00 01 00 00 00 00 00 ff ff ff ff ........ÿÿÿÿ
0x0000000100017114 ff ff ff ff 05 00 00 00 00 00 00 00 ÿÿÿÿ........
0x0000000100017120 64 64 64 64 64 00 00 00 00 00 01 00 ddddd.......
0x000000010001712C 00 00 00 00 ff ff ff ff ff ff ff ff ....ÿÿÿÿÿÿÿÿ
0x0000000100017138 01 00 00 00 00 00 00 00 74 00 00 00 ........t...
0x0000000100017144 00 00 00 00 00 00 01 00 00 00 00 00 ............
0x0000000100017150 ff ff ff ff ff ff ff ff 01 00 00 00 ÿÿÿÿÿÿÿÿ....
0x000000010001715C 00 00 00 00 66 00 00 00 00 00 00 00 ....f.......
0x0000000100017168 2a 70 72 65 73 73 20 3c 65 6e 74 65 *press <ente
0x0000000100017174 72 3e 2f 3c 72 65 74 75 72 6e 3e 20 r>/<return>
0x0000000100017180 74 6f 20 65 6e 64 20 74 68 69 73 20 to end this
0x000000010001718C 70 72 6f 67 72 61 6d 00 00 00 00 00 program.....
A very important thing to notice is the location where the array of pointers is located and
the location where the strings are located. They are NOT located in the same PE file section.
Because they are not in the same section of the PE file and, the sections have different
READ/WRITE attributes, the pointers can be altered but the string the original pointers
pointed to cannot because they reside in a READ ONLY section of the PE file.
That's why when LONGSTRINGS are OFF the strings are writeable but when LONGSTRINGS are
ON, attempting to change the contents of the string results in an access violation.
Here is the in-memory view of the mapped program:
0x100000000, Image, 152 kB, WCX, lib\x86_64-win64\PascalArrayOfStrings.exe
0x100000000, Image: Commit, 4 kB, R, lib\x86_64-win64\PascalArrayOfStrings.exe
0x100001000, Image: Commit, 80 kB, RX, lib\x86_64-win64\PascalArrayOfStrings.exe
0x100015000, Image: Commit, 8 kB, RW, lib\x86_64-win64\PascalArrayOfStrings.exe // the pointer array is in a read/write section
0x100017000, Image: Commit, 32 kB, R, lib\x86_64-win64\PascalArrayOfStrings.exe // the strings are in a READ ONLY section
// that's the reason for access violations when
// attempting to change the string contents
0x10001f000, Image: Commit, 16 kB, RW, lib\x86_64-win64\PascalArrayOfStrings.exe
0x100023000, Image: Commit, 4 kB, WC, lib\x86_64-win64\PascalArrayOfStrings.exe
0x100024000, Image: Commit, 4 kB, RW, lib\x86_64-win64\PascalArrayOfStrings.exe
0x100025000, Image: Commit, 4 kB, WC, lib\x86_64-win64\PascalArrayOfStrings.exe
HTH.
ETA:
Just in case, it is necessary to scroll horizontally to see some comments on the right hand side.