gpt4 book ai didi

character-encoding - 这个 Ada 字 rune 字格式是在哪里定义的?在 Ada 2005 中有什么变化?

转载 作者:行者123 更新时间:2023-12-05 03:33:41 25 4
gpt4 key购买 nike

我最近偶然发现了与此类似的代码,它是在 Ada 95 模式下编译的,而不是在 Ada 2005 模式下编译的:

with Ada.Text_IO;

procedure Test is

Printable_Char : constant Character := '["20"]';
Non_printable_Char : constant Character := '["00"]';
begin

Ada.Text_IO.Put_Line (Printable_Char & Non_printable_Char);

end Test;

使用 FSG GNAT 9.3.0:

test.adb:6:48: (Ada 2005) non-graphic character not permitted in character literal

但使用 -gnat95 标志(Ada 95 模式)编译正常。

我在 GNAT RM 的“11.6 Wide Text IO”一章中找到了一些关于这种格式的引用资料。 .这种格式是 GNAT 特有的吗?

关于语言版本模式的差异,我在Ada 2005 Rationale中没有提到。 .那么,为什么在 Ada 2005 模式下编译时会出现这种差异?

最佳答案

这记录在 the Ada 2012 Language Reference Manual

相关的引述是:

 -- The declaration of type Character is based on the standard ISO 8859-1 character set.

-- There are no character literals corresponding to the positions for control characters.
-- They are indicated in italics in this definition. See 3.5.2.

关于character-encoding - 这个 Ada 字 rune 字格式是在哪里定义的?在 Ada 2005 中有什么变化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70309317/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com