Re: typedef char *temp __attribute__ ((cleanup(free));

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 26 Jul 2004 19:14:28 -0500
Eljay Love-Jensen <eljay@xxxxxxxxx> wrote:

> Hi Leah,
> 
> I believe the cleanup attribute is associated with the variable, not
> with the type.  And not just any variable, it has to be an auto
> variable (not a static variable, not a parameter).
> 
> A typedef does not define a variable, it defines a type (or, really, a
> synonymous alias to a type).

Yes, but it should be possible to postpone the attribute's instantiation
until there's a variable it can be applied to.  ((aligned)) behaves that
way, for example.  I found a vague comment in the source
(c-common.c, 5488), but it doesn't help much:

/* ??? Could perhaps support cleanups on TREE_STATIC, much like we do
   for global destructors in C++.  This requires infrastructure that
   we don't have generically at the moment.  It's also not a feature
   we'd be missing too much, since we do have attribute constructor.  */

Somewhat later is the following nice thought:

/* ??? We could support pointers to functions here as well, if
   that was considered desirable.  */

-- 
Leah

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux