comp.lang.ada
 help / color / mirror / Atom feed
From: Samuel Tardieu <sam@ada.eu.org>
To: Dale Stanbrough <dale@goanna.cs.rmit.edu.au>
Subject: Re: Pragma inline results in duplicate strings?
Date: 1997/06/04
Date: 1997-06-04T00:00:00+00:00	[thread overview]
Message-ID: <m3hgfe629z.fsf@zaphod.enst.fr> (raw)
In-Reply-To: 5n2ohf$htn$1@goanna.cs.rmit.edu.au


>>>>> "Dale" == Dale Stanbrough <dale@goanna.cs.rmit.edu.au> writes:

Dale> Is the string duplicated for each inline call?

Not with GNAT.

See the following piece of code:

   with Ada.Text_IO; use Ada.Text_IO;

   procedure T is

      procedure Break;
      pragma Inline (Break);

      procedure Break is
      begin
         Put_Line ("<br>");
      end Break;

   begin
      Break;
      Break;
   end T;

It generates the following on a i386 with GNAT:

           .file   "t.adb"
           .version        "01.01"
   gcc2_compiled.:
   .section        .rodata
   .LC0:
           .string "<br>"
           .align 4
   .LC1:
           .long 1
           .long 4
 
(the .text section has been omitted)

So it appears that GNAT is sharing strings literal, at least for
several instances of the same string in the same package. I haven't
tested how it behaves with external calls to Break.

  Sam
-- 
Samuel Tardieu -- sam@ada.eu.org




  reply	other threads:[~1997-06-04  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-04  0:00 Pragma inline results in duplicate strings? Dale Stanbrough
1997-06-04  0:00 ` Samuel Tardieu [this message]
1997-06-07  0:00 ` Robert Dewar
1997-06-09  0:00 ` Tucker Taft
1997-06-11  0:00   ` Tucker Taft
replies disabled

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