On 04/12/2012 02:32 PM, Jani Nikula wrote:
> Hi all -
>> Recently, an issue came up with using talloc_steal() in C++ code. For
> recent GCC, talloc.h has some macro magic to provide type safety for
> talloc_steal(). Otherwise, it returns a 'void *', which is okay to
> assign to a non-void pointer in C, but not in C++. An explicit cast
> would be required, losing the type safety for recent GCC, which is not
> very nice if you want to support both GCC and non-GCC compilers.
>> As a workaround in the notmuch project, I proposed [1]. Slightly hacky,
> but maintains type safety and does not require any changes in
> talloc_steal() callers. Now if this was done directly in talloc.h, it
> would not be hacky at all... *hint* ;)
>> It's a corner case in many ways, and talloc is a C library, so you may
> not be interested, but this is just to let you know such an issue
> exists.
>> [1] http://mid.gmane.org/1334264259-17632-1-git-send-email-jani@nikula.org>>> BR,
> Jani.
>>> PS. I'm not subscribed; please keep me in the recipients.
Well it's basically all the function that are using _TALLOC_TYPEOF that
need to have an extra wrapper for C++ and (not gcc or old gcc).
Matthieu.