main.adb
来自「Ada 2005 Training Notes.」· ADB 代码 · 共 45 行
ADB
45 行
with PrefixedNotation;procedure Main is type T is record I: Integer; end record; type A1 is access all T; Ref1: A1; procedure P(Ptr: access T) is type A2 is access all T; Ref2: A2; begin -- raised PROGRAM_ERROR : main.adb:15 accessibility check failed -- Ptr's scope is in procedure P and Ref1's scope is longer then A1's. Ref1 := A1(Ptr); -- Ptr's scope is the same as A2's scope and has the same life duration Ref2 := A2(Ptr); end P;X1: aliased T;begin declare X2: aliased T; begin P(X1'Access); P(X2'Access); end;end Main;--procedure Main is-- Var : PrefixedNotation.T;--begin-- -- Subprogram first-- PrefixedNotation.P(X => Var);-- -- Object first-- Var.P;---- Main;--end Main;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?