News for hackers. Stuff that matters.
Re:Using the __cleanup__ variable attribute in GCC by castratikron on Friday August 14, 2015 @12:18PM (#10060965)
I learned about this a few years ago, but haven't made use of it at all. But I can see how it could be handy. I like using the vector attribute to make gcc generate vector instructions.
Re:Using the __cleanup__ variable attribute in GCC by buserror on Friday August 14, 2015 @10:10AM (#10060159)
Actually this is pretty cool, you can make the same sort of semantics as C++ stack based objects in plain C. With a couple macros you could make it pretty much feature equivalent.

Thanks for posting that!

Re:Using the __cleanup__ variable attribute in GCC by zvrba on Friday August 14, 2015 @12:34PM (#10061080)
"Plain C" is defined by the ISO C standard. Once you start using extensions like these you're better off going over to standard C++.
Re:Using the __cleanup__ variable attribute in GCC by Gibbon1 on Friday August 14, 2015 @05:47PM (#10063163)
Once you think you need to move from some flavor of C to standard C++ you should probably switch to a safe proper garbage collected language.
Re:Using the __cleanup__ variable attribute in GCC by saisi on Friday August 14, 2015 @01:40PM (#10061517)
Pretty cool.

Does anyone have recommendations on great books that cover advanced C internals (other than K&R) and/or GNU extensions for C?

Re:Using the __cleanup__ variable attribute in GCC by bleakgadfly on Thursday August 27, 2015 @06:21AM (#10128537)
Re:Using the __cleanup__ variable attribute in GCC by revelation on Friday August 14, 2015 @01:47PM (#10061566)
Or, you know, just use C++ if you want to do this.

No worries, it doesn't hurt, you won't have to use iterators and new.

Re:Using the __cleanup__ variable attribute in GCC by slrz on Friday August 14, 2015 @06:43PM (#10063432)
Nah. I think that for many programs the GNU extensions to C provide a better tradeoff in terms of expressiveness vs. added complexity than the truckload of arbitrary features that is C++.