comp.lang.ada
 help / color / mirror / Atom feed
From: Gautier write-only <gautier_niouzes@hotmail.com>
Subject: Re: Disabling string evaluation in a logging system
Date: Tue, 18 May 2010 04:27:43 -0700 (PDT)
Date: 2010-05-18T04:27:43-07:00	[thread overview]
Message-ID: <3d545554-3182-46df-ab96-0201eac851a9@k31g2000vbu.googlegroups.com> (raw)
In-Reply-To: 5b94cf13-b7e7-4079-97c6-87dd03f29933@o39g2000vbd.googlegroups.com

OK, I missed the point about "&", To_String etc., as the example below
shows.
If you combine Stefan's solution and the Inline pragma, it should be
fine...
Gautier
_____________
with Log;
-- Try preventing compiler from optimizing parameters out...
-- -> Dynamic data.
with Ada.Command_Line, Ada.Strings.Unbounded;
--
procedure Test_Opti_inline is
  use Ada.Strings.Unbounded;
  --
  procedure Tricky(Param_Name: Unbounded_String; X: Integer) is
  pragma Inline(Tricky);
  begin
    Log.Write (Text => "Parameter " & To_String (Param_Name) & " Value
= " & Integer'Image (X), Level => 0);
  end Tricky;
  --
  Param_Name: Unbounded_String:=
To_Unbounded_String(Ada.Command_Line.Command_Name);
  X: Integer:= Ada.Command_Line.Argument_Count;

begin
  Log.Write (Text => "Blabla...", Level => 5);
  Log.Write (Text => "No no no!", Level => 0);
  Tricky (Param_Name => Param_Name, X => X); -- Hope: this is
optimized out.
end;



  parent reply	other threads:[~2010-05-18 11:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-18  7:48 Disabling string evaluation in a logging system dhenry
2010-05-18  8:15 ` Dmitry A. Kazakov
2010-05-18  8:45   ` Dmitry A. Kazakov
2010-05-18  9:45   ` Cyrille
2010-05-18 10:26     ` Dmitry A. Kazakov
2010-05-18 12:10       ` Georg Bauhaus
2010-05-18 12:15         ` Georg Bauhaus
2010-05-18 12:54         ` Dmitry A. Kazakov
2010-05-18  9:32 ` Gautier write-only
2010-05-18  9:37   ` Gautier write-only
2010-05-18 11:27   ` Gautier write-only [this message]
2010-05-18 12:18     ` dhenry
2010-05-19  9:04       ` Stephen Leake
2010-05-19 12:38         ` Dmitry A. Kazakov
2010-05-19 18:02           ` (see below)
2010-05-19 19:08             ` Adam Beneschan
2010-05-18 10:13 ` stefan-lucks
2010-05-18 18:17   ` Jeffrey R. Carter
2010-05-18 18:40 ` tmoran
2010-05-19  7:47   ` dhenry
replies disabled

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