comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <bauhaus@futureapps.invalid>
Subject: Re: no code generation for c strings
Date: Sat, 4 Jun 2016 08:31:14 +0200
Date: 2016-06-04T08:31:14+02:00	[thread overview]
Message-ID: <nitsji$v1g$1@dont-email.me> (raw)
In-Reply-To: <ca06c218-440f-4009-96e7-a76018e67d77@googlegroups.com>

On 03.06.16 19:00, Lucretia wrote:
> On Friday, 3 June 2016 15:27:59 UTC+1, G.B.  wrote:
>
>> If "&" will be become a function call, then
>>
>>    S : constant char_array := ('h', 'e', 'l', 'l', 'o', nul);
>
> I want to avoid having to spell out all these function names like that thanks, and not really sure what you mean about the & there.
>

By RM4.9(6) and RM4.9(20), "&" might be a static function. I'm not sure.
In any case, for S to become static, adding constraints seems to be sufficient:

package Static is
    S  : constant char_array          := "hello" & nul;
    S1 : constant Char_Array (0 .. 5) := "hello" & nul;
    
    X  : constant := S'Length;
    X1 : constant := S1'Length;
end Static;


      1. with Interfaces.C; use Interfaces.C;
      2.
      3. package Static is
      4.    S  : constant char_array          := "hello" & nul;
      5.    S1 : constant Char_Array (0 .. 5) := "hello" & nul;
      6.
      7.    X  : constant := S'Length;
                             |
         >>> non-static expression used in number declaration
         >>> prefix is non-static array (RM 4.9(8))

      8.    X1 : constant := S1'Length;
      9. end Static;


-- 
"HOTDOGS ARE NOT BOOKMARKS"
Springfield Elementary teaching staff

  reply	other threads:[~2016-06-04  6:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-03  8:14 no code generation for c strings Luke A. Guest
2016-06-03  8:25 ` Dmitry A. Kazakov
2016-06-03  9:23   ` Luke A. Guest
2016-06-03  9:37     ` Dmitry A. Kazakov
2016-06-03 14:27       ` G.B.
2016-06-03 17:00         ` Lucretia
2016-06-04  6:31           ` Georg Bauhaus [this message]
2016-06-03 16:30   ` Simon Wright
2016-06-03 17:04     ` Lucretia
2016-06-03 18:45       ` Simon Wright
2016-06-03 20:30         ` Luke A. Guest
2016-06-03 21:25           ` Simon Wright
2016-06-03 21:33             ` Luke A. Guest
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox