From dc30ed2eaf8db9c0d54adaa912c574556408f86c Mon Sep 17 00:00:00 2001 From: Kristoffer Date: Mon, 1 May 2023 13:54:47 +0200 Subject: [PATCH] give a hint towards `__attribute__((cleanup)` for RAII type behavior in C --- manual/tracy.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manual/tracy.tex b/manual/tracy.tex index 6d2683a2..3822a9e1 100644 --- a/manual/tracy.tex +++ b/manual/tracy.tex @@ -1880,7 +1880,7 @@ The following macros mark the beginning of a zone: Refer to sections~\ref{markingzones} and~\ref{multizone} for description of macro variants and parameters. The \texttt{ctx} parameter specifies the name of a data structure, which the macro will create on the stack to hold the internal zone data. -Unlike C++, there's no automatic destruction mechanism in C, so you will need to mark where the zone ends manually. To do so use the \texttt{TracyCZoneEnd(ctx)} macro. +Unlike C++, there's no automatic destruction mechanism in C, so you will need to mark where the zone ends manually. To do so use the \texttt{TracyCZoneEnd(ctx)} macro.\footnote{GCC and Clang provide \texttt{\_\_attribute\_\_((cleanup))} which can used to run a function when a variable goes out of scope.} Zone text and name may be set by using the \texttt{TracyCZoneText(ctx, txt, size)}, \texttt{TracyCZoneValue(ctx, value)} and \texttt{TracyCZoneName(ctx, txt, size)} macros. Make sure you are following the zone stack rules, as described in section~\ref{multizone}!