comp.lang.ada
 help / color / mirror / Atom feed
From: "Martin Krischik" <krischik@users.sourceforge.net>
Subject: Re: Conditional compilation of debug traces without cpp
Date: 5 Jul 2006 22:53:18 -0700
Date: 2006-07-05T22:53:18-07:00	[thread overview]
Message-ID: <1152165198.400494.175100@p79g2000cwp.googlegroups.com> (raw)
In-Reply-To: <44ac1562$0$10269$636a55ce@news.free.fr>


guillaume.portail@grospied.enanglais.com wrote:
> Jean-Pierre Rosen wrote:
>
> > Switching packages is then not more difficult than changing a #define...
>
> Nice, thank you ! And thank you for your Debug package, I already know
> about it.
>
> But don't you think that the elaboration of the calls will still exist ?
> Executing the statement :
>
> 	Null_Proc ("I was here" & Function_Call(A+12));
>
> will always produce a call to Function_Call, even if Null_Proc has a
> null body, I guess.
> I have zillion of 'complicated' traces like this :
>
> 	Traces.Put_Info ("Mouse at home, ears=" & (+Mice.ears)
>                                        & "tong=" & (+Mice.tong)
>                                        ...
>                                        & "legs=" & (+Mice.legs));
>
> where "+" is a rename of some kind of 'Image, may be a sophisticated
> one. In general returning fixed-length strings, but not always. So I
> suspect that theses traces call every "+" involved in the elaboration of
> the call, maybe doing heap allocation, even when Trace.Put_info is null.

Indeed. For simple cases "-O3" and "pragma Inline" will help. For GNAT
you can take it furher with pragma "Pure_Function" but you are right:
eventually you reach the point where functions will be called even when
the result is not needed.

You could use "GNAT PREPROCESS" - which gives you the same solution as
C/C++: a text preprocessor. With all the advantages and disadvantages.
Well not quite: "GNAT PREPROCESS" writes the preprocessed file to the
drive - which has it's own set advantages and disadvantages.

Martin




  reply	other threads:[~2006-07-06  5:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-04 18:06 Conditional compilation of debug traces without cpp guillaume.portail
2006-07-04 19:07 ` Ludovic Brenta
2006-07-04 19:14   ` guillaume.portail
2006-07-04 21:39     ` Björn Persson
2006-07-04 21:43       ` guillaume.portail
2006-07-04 22:01         ` Björn Persson
2006-07-05  3:10     ` Matthew Goulet
2006-07-04 20:24 ` Gautier
2006-07-04 20:54 ` Simon Wright
2006-07-05 13:03 ` Jean-Pierre Rosen
2006-07-05 19:39   ` guillaume.portail
2006-07-06  5:53     ` Martin Krischik [this message]
2006-07-07 10:32       ` Stephen Leake
2006-07-07 14:08         ` M E Leypold
2006-07-06  7:59     ` Jean-Pierre Rosen
2006-07-06 20:25       ` guillaume.portail
2006-07-07  5:00         ` Matthew Goulet
2006-07-07 13:57           ` Thierry Bernier
2006-07-07 21:08           ` Randy Brukardt
replies disabled

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