Достаточно понять, что в Паскале этого делать не нужно. Не надо делать те вещи, которые предлагают другие языки программирования, особенно, если оно очень не подходят для Паскаля.
Достаточно создать структуру (уже создана?) и сделать на её основе динамический массив. В нужный момент просто либо ставить указатель на элемент, либо просто брать элемент массива.
Да, работы будет больше, но конечный результат будет такой же.
Да, мы можем сделать практически то же самое что в C, но работы всё равно будет больше (если конечно уже не готовы решения). Всё равно придётся выделать память, а по закрытию программы обязательно освобождать её.
-----------------------------------------------
Google translate:
It’s enough to understand that you don’t need to do this in Pascal. There is no need to do those things that other programming languages offer, especially if it is very unsuitable for Pascal.
It is enough to create a structure (already created?) and make a dynamic array based on it. At the right time, you can simply either put a pointer to an element, or simply take an element of the array.
Yes, there will be more work, but the end result will be the same.
Yes, we can do almost the same thing as in C, but there will still be more work (unless, of course, solutions are already ready). You still have to allocate memory, and after closing the program, you must free the memory.
framebuffer_palette : array of multiboot_color;
...
// create
SetLength(framebuffer_palette, len_multiboot_color);
// Use the following code if the structure is complex.
for i := 0 to len_multiboot_color - 1 do
GetMem(pointer(framebuffer_palette[i]), SizeOf(multiboot_color));
...
// destroy
// Use the following code if the structure is complex.
for i := 0 to len_multiboot_color - 1 do
begin
FreeMem(framebuffer_palette[i]);
framebuffer_palette[i] := nil;
end;
// required code
SetLength(framebuffer_palette, 0);
...
Yes, for beginners it is not entirely easy. But if necessary, then it’s enough just to remember what to do.
Rus:
Да, для новичков это не совсем просто. Но если надо, то достаточно просто запомнить что надо делать.