I've recently stumbled upon code similar to this, which compiled in Ada 95 mode and not in Ada 2005 mode:
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;
Using FSG GNAT 9.3.0:
test.adb:6:48: (Ada 2005) non-graphic character not permitted in character literal
But compiles OK using -gnat95
flag (Ada 95 mode).
I found some references of this format in chapter "11.6 Wide Text IO" of GNAT RM. Is this format GNAT specific?
Regarding the difference in the language version mode, I found no mention of it in the Ada 2005 Rationale. Then, why that difference when compiling in Ada 2005 mode?
This is documented in the Ada 2012 Language Reference Manual
The pertinent quotation is: