Sign in Join
Wiki copytemporary

^/ru: what changed

Revision 5 to 6. Removed lines have a minus sign; added lines have a plus sign.

Title: &/ru ^/ru

OldNewLine
1-&
1+^
22
3-В кодировках [[ASCII/ru|ASCII]] и [[FPC Unicode support/ru|Unicode]] символ с десятичным кодом 38 (или [[Hexadecimal/ru|шестнадцатеричным]] 26) определен как символ &.
3+В кодировках [[ASCII/ru|ASCII]] и [[FPC Unicode support/ru|Unicode]] символ с десятичным кодом `94` (или [[Hexadecimal/ru|шестнадцатеричным]] `5E`) определен как символ **^** (Circumflex accent).
44
5-Символ **&** (читается "Амперс**а**нд" или "Амперс**е**нд") используется в Lazarus в следующем случае:
5+Для любого типа данных [[Pointer/ru|тип `pointer`]] для этих данных может быть объявлен с помощью оператора **^** перед [[Data type/ru|типом данных]].
66
7-- он указывает на горячую клавишу в элементе [[TMenuItem/ru|TMenuItem]]
7+
88
9+```
10+1program pointerDemo(input, output, stderr);
11+ 2
12+ 3type
13+ 4 listItem = record
14+ 5 payload: integer;
15+ 6 // следующий пункт по элементу списка
16+ 7 next: ^listItem;
17+ 8 end;
18+ 9
19+ 10var
20+ 11 start: ^listItem;
21+ 12
22+ 13begin
23+ 14 new(start);
24+ 15 if not assigned(start) then
25+ 16 begin
26+ 17 writeLn(stderr, 'не удалось получить память для start');
27+ 18 halt(1);
28+ 19 end;
29+```
30+
31+Содержимое `pointer` можно отслеживать, _разыменовывая_ его путем добавления [символа] `^` к [[Identifier/ru|идентификатору]]. Вместо того, чтобы имеющегося у вас на руках адреса памяти, вы сможете посмотреть на содержимое памяти _по_ этому адресу. Если это типизированный указатель, операции и синтаксис для этого типа корректны, например, операция [[Becomes/ru|присвоения]] в следующем примере.
32+```
33+21 // разыменование указателя, т.е. его отслеживание
34+ 22 start^.payload := 7;
35+ 23
36+ 24 dispose(start);
37+ 25end.
38+```
39+
40+Однако попытка отследить [[Nil/ru|`nil`'евой]] указатель приведет к ошибке [[runtime error|времени выполнения]] (RTE 216 “general protection fault”). В такой ситуации условие`not assigned(start)` в строке 15 предназначено для отлова [этой коллизии].
41+
42+## См.также
43+
44+ * [`{$pointerMath off}`](</index.php?title=sPointermath&action=edit&redlink=1> "sPointermath \(page does not exist\)") запрещает использование указателей в арифметических выражениях
45+ * [`{$typedAddress on}`](</index.php?title=sTypedaddress&action=edit&redlink=1> "sTypedaddress \(page does not exist\)") в сочетании с оператором получения адреса [[@/ru|`@`]]
46+ * [`{$modeSwitch autoDeref-}`](</index.php?title=sModeswitch&action=edit&redlink=1> "sModeswitch \(page does not exist\)") \- автоматическое (тихое) разыменование типизированных указателей
47+
48+
49+
50+navigation bar: topic: Pascal symbols single characters | [[Plus/ru|`+` (плюс)]] • [[Minus/ru|`-` (минус)]] • [[*/ru|`*` (звездочка)]] • [[Slash/ru|`/` (слеш)]]
51+[[Equal/ru|`=` (равно)]] • [[Greater than/ru|`>` (больше чем)]] • [[Less than/ru|`<` (меньше чем)]]
52+[`.` (точка)](</index.php?title=period/ru&action=edit&redlink=1> "period/ru \(page does not exist\)") • [[Colon/ru|`:` (двоеточие)]] • [`;` (точка с запятой)](</index.php?title=;/ru&action=edit&redlink=1> ";/ru \(page does not exist\)")
53+`^` (hat) • [[@/ru|`@` (at)]]
54+[[Dollar sign/ru|`$` (dollar sign)]] • [[&/ru|`&` (ampersand)]] • [`#` (hash)](</index.php?title=Hash/ru&action=edit&redlink=1> "Hash/ru \(page does not exist\)")
55+[`'` (single quote)](</index.php?title=%27/ru&action=edit&redlink=1> "'/ru \(page does not exist\)")
56+---|---
57+character pairs | [[Not equal/ru|`<>` (не равно)]] • [`<=` (less than or equal)](</index.php?title=Less_than_or_equal/ru&action=edit&redlink=1> "Less than or equal/ru \(page does not exist\)") • [[Becomes/ru|`:=` (присвоить)]] • [`>=` (greater than or equal)](</index.php?title=Greater_than_or_equal/ru&action=edit&redlink=1> "Greater than or equal/ru \(page does not exist\)") • [[symmetric difference|`><` (symmetric difference)]] • [[Slash|`//` (double slash)]]
58+
59+
60+****
61+
962---
10-*From the Free Pascal wiki, page "&/ru", as it stood on 2018-03-19 after a change by Useroflazarus, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
11-Category: Symbols/ru
63+*From the Free Pascal wiki, page "^/ru", as the Internet Archive kept it on 2022-08-16, last changed on 2022-08-06. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history